-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 To whom it may concern,
On 10/8/12 11:17 AM, MrVJTod wrote: > In linux/solaris, I can specify > -Xloggc:/my/logs/sourcecode-gc-${NOW}.log And get a logfile named > as such /my/logs/sourcecode-gc-1008-0938.log with the last time of > startup as past of the log filename > > But if I try to do something similar in Windows > -Xloggc:c:\my\logs\sourcecode-gc-${NOW}.log I get a logfile named > c:\my\logs\sourcecode-gc-${NOW}.log with the variable text as past > of the log filename > > Does tomcat on Windows not support variables in the GC filename? > I've tried a dozen different combinations $DATE // ${%DATE%} > // $[%DATE%] // $(%DATE%) ${DATE} // $[DATE] // $(DATE) // > $DATE // %DATE // %NOW% `%DATE%` // '%DATE%' // `cmd /c now > /t` // 'cmd /c now /t' %Y // %YYYY and several other > iterations but the logfilename contains the variable that I was > hoping would be replaced with a timestamp. > > and I can't seem to find a solid reference for Windows GC log > filenames. This has nothing to do with GC filenames and everything to do with the way cmd.exe does variable replacement. First of all, cmd.exe does not recognize backtics (``) as meaningful in any way, so that's not going to work. Second, sh-style $varname doesn't work either. cmd.exe (and every version of MS-DOS CLI before it) has always used %varname% for variable replacement. Lastly, the variable has to have a value. If you haven't set a value for the DATE variable, then it will give you nothing. (Okay, I'm floored: 'echo %DATE%' in cmd.exe actually gives you the current date - "Mon 10/08/2012" for me. That seems to be ringing a bell from back in my MS-DOS days, but the value you get isn't very friendly: it's got a space and it's localized for the current user: stupid American date formatting.) I'm not sure what the best way to get the current date in an environment variable is. win32's "date" command totally sucks: you can't tell it how to format the date. You also can't use command-substitution (back ticks) to get the output from a program - you could write one to get the proper date format - into an environment variable. Child processes can't modify the environment of the parent. I think this is why people end up writing hideout scripts for win32 that do things like create another script on-the-fly and do string-replacement directly on the script, then run it. If you have your date in a variable, like 'NOW', then you ought to be able to use "c:\my\logs\sourcecode-gc-%NOW%.log". Of course, that will only work if you are launching Tomcat from the command-line and not if you are running as a service. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBzHxMACgkQ9CaO5/Lv0PCJugCguC9GXRauvUyjjVOtuXO2mmuK iDUAnj/YxvmDZWEvYZnwBGFgOAHjd5EN =/dAU -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org