Salesforce

WorldServer - how to configure a separate Garbage Collector Log and enable Maintenance logging in general.properties

« Go Back

Information

 
TitleWorldServer - how to configure a separate Garbage Collector Log and enable Maintenance logging in general.properties
URL Name000013041
SummaryThis article explains how to configure a separate Garbage Collector Log file in SDL WorldServer 11.x. Note: changes have been introduced in version 11.6.
Scope/EnvironmentWorldServer
Question
How can we configure WorldServer to create a separate Log containing only entries related to Garbage Collector? This is particularly useful if Garbage Collector is not running and you want to troubleshoot the issue. Also, we would like to get more details about the Garbage Collection.
Answer
In WorldServer 11.1, 11.2, 11.3, 11.4 and 11.5, in general.properties (under WS_CONFIG), add these lines, adapt the path associated with log4j.appender.myappender.File= to the logs folder directory on the server. Also, you can add the Maintenance class logging to get more information as follows:
 
log4j.category.com.idiominc.ws.maintenance=DEBUG, myappender
log4j.appender.myappender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.myappender.datePattern='-'dd'.log'
log4j.appender.myappender.File=C:\\WORLDSERVER\\\logs\\\GarbageCollector.log
log4j.appender.myappender.layout=org.apache.log4j.PatternLayout
log4j.appender.myappender.layout.conversionPattern=[%d] %p %t %c: %m%n

If you work in a clustered environment, the log file should be configured on the server where the recurrence engine is running. The recurrence engine should always run only on one server. This is the property that controls if the recurrence engine is on or off:

recurrence_engine=on

Note: Be aware that in 11.x versions before 11.6,  the entries from the separate Garbage Collector log are also entered in the ws-legacy log. This means that the ws-legacy log file might be overridden with the verbose entries from the maintenance debug logging. If you are worried about losing previous log entries, make a copy of your ws-legacy log files before enabling maintenance debug logging. Also, this logging is supposed to be temporary for troubleshooting issues with Garbage Collection. It should be disabled or set to warn once GC has run and re-enabled only if necessary.

Starting from WorldServer 11.6, the logging procedure has changed. This is what you should add to general.properties under WS_CONFIG/ws-legacy:
 
appenders=rolling, appenderFordbStatsLogger, appenderForthreadDumpLogger, appenderGCLogger
loggers = dbStatsLogger, threadDumpLogger, processEnginesEnd, rolling, appenderGCLogger

appender.appenderGCLogger.type = RollingFile
appender.appenderGCLogger.name = appenderGCLogger
appender.appenderGCLogger.fileName = c:/_ws/logs/gc.txt
appender.appenderGCLogger.filePattern = c:/_ws/logs/gc.txt.%i
appender.appenderGCLogger.layout.type = PatternLayout
appender.appenderGCLogger.layout.pattern = [%d] %p %C{1.} [%t] %m%n
appender.appenderGCLogger.policies.type = Policies
#appender.appenderFordbStatsLogger.policies.time.type = TimeBasedTriggeringPolicy
#appender.appenderFordbStatsLogger.policies.time.interval = 2
#appender.appenderFordbStatsLogger.policies.time.modulate = true
appender.appenderGCLogger.policies.size.type = SizeBasedTriggeringPolicy
appender.appenderGCLogger.policies.size.size=25MB
appender.appenderGCLogger.strategy.type = DefaultRolloverStrategy
appender.appenderGCLogger.strategy.max = 3
logger.appenderGCLogger.additivity = false
logger.appenderGCLogger.appenderRef.rolling.ref = appenderGCLogger
logger.appenderGCLogger.name = com.idiominc.ws.maintenance
logger.appenderGCLogger.level = debug

Make sure to adapt the directory associated with appender.appenderGCLogger.fileName and appender.appenderGCLogger.filePattern to the folder directory on the server.

appender.appenderGCLogger.policies.size.size: You can set the maximum file size as you prefer. In this example, we have set the max size to 25MB

appender.appenderGCLogger.strategy.max: This defines how many files with older settings you want to create. In the example above, if Garbage Collector writes a lot of data and the file reaches 25 MB file size, a second file will be added, and so on. After the 3rd one has reached the maximum size, the first one will be removed and a new one created. You can set this value to any number you want: 10, 20, 50, 100 etc.

In WorldServer version 11.6. and later, the logging entries will be written into the separate Garbage Collector log only and not in the ws-legacy.log as well, as in previous versions.

This article explains how to read the entries created by the Maintenance debug logging:

WorldServer - after enabling Maintenance debug logging, which Garbage Collector entries can be found in the log files, especially for Project Cleaner and how to read them?

https://docs.sdl.com/770288/816213/sdl-worldserver-11-6-user-documentation/sample-logging-configuration-for-the-garbage-collector
Reference
Attachment 1 
Attachment 2 
Attachment 3 
Attachment 4 
Attachment 5 

Powered by