This article addressed the six types of logging in Flux and how to configure them through a properties file, and code.
There are several different ways Flux can log. Below is a listing and brief description of each.
INTERNAL_ASYNCHRONOUS: When using the internal_asynchronous logger, there is a separate logging thread that runs and logs as events occur.
INTERNAL_SYNCHROUNOUS: When using the internal_synchronous logger, logging is only committed at transaction breaks. This means that only a successful execution path will show events be logged.
LOG4J: When using a log4j.properties or log4j.zml file, you can configure Flux to log using log4j. This can be very helpful when embedding Flux and your application is already logging to log4j.
JDK: Using this logger tells Flux to use the JDK logger (Java 1.4 and higher).
STANDARD_ERROR: The standard_error logger outputs WARNING and SEVERE level errors to wherever standard out is directed.
NULL: Setting Flux to log to null, means that it will not log at all. The null logger cannot be used in cooperation with other loggers.
Flux can be configured to log to our internal loggers, log4j, jdk logging, standard error logging, perform no logging or do any combination of the first four options.
To configure multiple loggers in a properties file:
logger_type.0=internal_asynchronous
logger_type.1=log4j
To configure multiple loggers in code:
Configuration configuration = factory.makeConfiguration();
Set loggerTypes = new HashSet();
loggerTypes.add(LoggerType.LOG4J);
configuration.setLoggerTypes(loggerTypes);
If you want Flux to log internally, the internal logger must be the first logger in your list.