Package apps.util
Class Log4JUtil
java.lang.Object
apps.util.Log4JUtil
Common utility methods for working with Log4J.
Two system properties influence how logging is configured in JMRI:
- jmri.log
- The logging control file. If this file is not an
absolute path, this file is searched for in the following order:
- JMRI settings directory
- JMRI installation (program) directory
- jmri.log.path
- The directory for storing logs. If not specified, logs are stored in the JMRI preferences directory.
See also jmri.util.TestingLoggerConfiguration in the Test code for Tests Logging Setup.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetLoggingConfig(String logFileLocation) (package private) static void(package private) static voidInitialize Log4J.static voidInitialize logging from a default control file.static voidinitLogging(String controlfile) Initialize logging, specifying a control file.static StringstartupInfo(String program)
-
Field Details
-
DEFAULT_LCF_NAME
- See Also:
-
SYS_PROP_LCF_LOCATION
- See Also:
-
SYS_PROP_LOG_PATH
- See Also:
-
-
Constructor Details
-
Log4JUtil
public Log4JUtil()
-
-
Method Details
-
initLogging
Initialize logging from a default control file.Primary functions:
- Initialize the JMRI System Console.
- Set up the slf4j j.u.logging to log4J bridge.
- Start log4j.
- Initialize a default exception handler.
-
initLogging
Initialize logging, specifying a control file.Generally, only used for unit testing. Much better to use allow this class to find the control file using a set of conventions.
- Parameters:
controlfile- the logging control file
-
initLog4J
Initialize Log4J.Use the logging control file specified in the jmri.log property or, if none, the default_lcf.xml file. If the file is absolute and cannot be found, look for the file first in the settings directory and then in the installation directory.
- Parameters:
logFile- the logging control file- See Also:
-
getLoggingConfig
-
initializeJavaUtilLogging
-
startupInfo
-