-Xss256k -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintClassHistogram -XX:+PrintClassHistogramBeforeFullGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:PrintFLSStatistics=1 -verbose:gc -XX:GCLogFileSize=64m -XX:NumberOfGCLogFiles=2 -XX:+UseGCLogFileRotation -Xloggc:./logs/gc.log
Above is the full list of JAVA_OPTS that I pass for my application. The problem is that the gc.log file is not created sometimes if the log directory does not exist by the time the application starts. But gc.log is always created if I am sure that the log directory exists by the time the application starts.
I understand correctly that before my log4j platform creates a log directory, if GC happens, will Xloggc work safely? Is there a different workaround than pre-creating the log directory?
source share