is there a way to get the unscoped.log on 2025?
# adobe
m
is there a way to get the unscoped.log on 2025?
s
since update 7 (2023) and update 13 (2021) it should be done automatically if the jvm flag of searchimplicitscopes is set to true - I would have thought that behaviour would carry over to 2025
m
I was hoping that as well, but doesn't appear to be the case.
s
non-consistency from the cf team? Surely not…
m
I thought it was mentioned that this JVM flag was not going to CF25. It was for CF23 and CF21 exclusively.
💯 1
s
@Mike Greider if you did see that can you link where you seen it? That’d be great, I hadn’t seen anything in that vein
I know the flag was meant as a stopgap so I could see why they wouldn’t carry it over, but as it was what caused the unscoped log I thought they’d leave it in
"Note that Adobe has indicated in the update technote that the new JVM arg will NOT be supported in the next and future releases, so you will NOT be able to rely on that 3rd option beyond CF2023. You will instead need to consider either of the first two options."
Probably somewhere in the technote too, but Charlie's blog is where I remember it.
m
both the setting in application.cfc as well as the JVM flag seem to be honored for search implicit scopes
s
@Matt Jones in 2025?
m
yeah (windows, commandbox, cfengine adobe@2025, openjdk21), at least in what i've been testing, but no unscoped.log.
my understanding was like mikes about at least the jvm arg going away. My impression was you'd have to fix the code or use the application.cfc setting.
d
I think @Mike Greider is right, 2025 doesn't support that jvm arg. That makes the log unnecessary, because unscoped var references will actually crash. You can make a tiny test file to try that. I made one in 2021, because I expected a lot of unscoped references in our (longstanding) apps, and didn't see any in dev after a bit, but the log does work, as my test file and the entries it caused show.
m
@Dave Merrill my experience with 2025 is it doesn't crash. it honors the Application.cfc setting for search implicit scopes, and in the absence of that, still also seems to honor the jvm flag.
I wanted the ability to get the unscoped log in 2025, since we are trying to go from 2018 to 2025. was hoping to only need to run 2 versions for development, instead of 3. 😐
d
Well that's unexpected at least to me. Just to be clear, what I meant by it crashing is that if the code hits any unscoped var references that aren't found in the variables, local, query, or arguments scope, that will crash, because it won't honor that flag. If that's not the case, I don't know what the statements about that flag not being supported in 2025 could possibly mean. See Charlie's helpful post about all this. The docs on scopes don't mention it at all, oddly.
@Matt Jones Can you verify that on 2025, WITHOUT the application.cfc flag unscoped variable references DO crash, and WITH the flag they don't? If that's really true, it means there's less urgency around getting rid of unscoped references, IF you're willing to accept the scope injection risk.
m
I didn't expect the jvm flag to work, based on charlie's article, so was surprised that it seems to, however i did expect the application setting to work, which it does seem to, in practice, i wouldn't have set the jvm arg anyway, as none of the applications i wrote need it, but some of the ones i'm maintaining do, so my pattern was going to be to use the application setting only where needed anyway.
1. JVM flag not included. Application setting not included or false. = failed variable undefined 2. JVM flag not included. Application setting true = successful 3. JVM flag inclued. Application setting not included or true = successful 4. JVM flag included. Application setting false. = failed variable undefined
👍 1
windows, commandbox, adobe@2025, openjdk21
Copy code
{
  "app": {
    "cfengine": "adobe@2025"
  },
  "name": "demo",
  "runwar": {
    "undertowOptions": {
      "ALLOW_UNESCAPED_CHARACTERS_IN_URL": "true"
    }
  },
  "web": {
    "http": {
      "port": 80
    }
  },
  "scripts": {
    "onServerInstall": "cfpm install ftp,image,pdf,htmltopdf,zip,sqlserver,debugger,caching,document,mail,spreadsheet,search"
  },
  "JVM": {
    "javaVersion": "openjdk21",
    "heapsize": "512",
    "args": [
      "-Dcoldfusion.searchimplicitscopes=true"
    ]
  },
  "commandbox_home": "C:/CommandBox"
}
my server.json when i have flag, only removal between with or without was the jvm args portion
d
Cheers sir, thanks for testing and writing that up. Should that first item be "JVM flag not included. Application setting NOT included or false"?
m
yes
👍 1
my expectation was the jvm flag wasn't going to work. but i had copied it over from my 2023 config, and removed the application setting to test and didn't see what i expected
d
So it seems having either the jvm flag or the application setting true allows unscoped var resolution. That's the same as 2021, isn't it? @Mark Takata (Adobe) Is this behavior expected to change at some point?
1
m
Hey Dave. The plan at some point is to no longer allow unscoped vars, flag/setting or not. It is officially "deprecated", meaning it can be removed at any time. There's no current "drop dead" date however.
d
Thanks for clarifying. And no we don't WANT to have unscoped vars, just big apps with long history, and some really old code that's still there.
Does anyone have an estimate of the performance overhead of having unscoped variable logging enabled? I've turned in on in dev, but prod sees a ton more traffic, and way more variation of user actions, so turning it on there would probably find a lot more issues.
z
really depends on your code quality...