Currently I can print out logs in my console via GridLogger, but I am wondering how I can store logs into a file via GridLogger. In the GridGain conf directory, there are two files: gridgain-log4j.xml and java.util.logging.properties. How can I load these files in my application?
Thanks, Bill
GridGain always writes log to file by default (and additionally to console if verbose mode is enabled). If you haven't done any changes to configuration, log files will be stored in $GRIDGAIN_HOME/work/log
folder. Note that when nodes are started using ggstart.{sh|bat}
script, $GRIDGAIN_HOME
will be automatically resolved to your GridGain distribution root directory if it's not set via system property or environment variable.
In case $GRIDGAIN_HOME
is unknown (e.g., you're running a node in embedded mode inside Web container), log files will be stored in $TMP_DIR/gridgain/work/log
folder, where $TMP_DIR
is the temporary directory in your OS. Your can override this behavior via GridConfiguration.setWorkDirectory()
configuration property. Work directory provided here will be used by different GridGain components including logger, which will create log
subfolder for log files.
There is also an option to manually configure one of GridLogger
implementations available out of the box, or even provide your own. GridLogger
instance can be set via GridConfiguration.setLogger()
property.
By default GridGain uses Java logger configured with java.util.logging.properties
file included in distribution. If you want to switch to log4j, you will need to enable gridgain-log4j
module - logger will be changed automatically and will be configured with gridgain-log4j.xml
. For more information on how to enable/disable modules refer to readme.txt
file located in libs
folder of GridGain distribution.