- public static final boolean ENABLED = true;
- //public static final boolean ECHO = Development.DEVELOPMENT || false;
- public static final Properties defaultProperties = new Properties();
- static {
- defaultProperties.put("log4j.rootCategory", "ERROR, default");
- defaultProperties.put("log4j.appender.default", "org.apache.log4j.FileAppender");
- defaultProperties.put("log4j.appender.default.File", InternalClientConfig.DB_CLIENT_LOG_FILE);
- defaultProperties.put("log4j.appender.default.append", "true");
- defaultProperties.put("log4j.appender.default.layout", "org.apache.log4j.PatternLayout");
- defaultProperties.put("log4j.appender.default.layout.ConversionPattern", "%d{ISO8601} %-6r [%15.15t] %-5p %30.30c - %m%n");
- }
- private static LogManager defaultLogManager = new LogManager(defaultProperties);
- private static final Logger defaultErrorLogger = new Logger(LogManager.class);
- private org.apache.log4j.Logger logger;
- Logger(Class<?> clazz) {
- logger = defaultLogManager.getLogger(clazz);
- }
-
- /**
- * Log a trace event.
- *
- * @param message message of the trace
- * @param exception the exception, or <code>null</code>
- */
- public void logTrace(String message, Throwable exception) {
-
- if(!logger.isTraceEnabled()) return;
-
- // Errors are much more useful with a stack trace!
- if (exception == null) {
- exception = new RuntimeException();
- }
- logger.trace(message, exception);
-
- if (Development.DEVELOPMENT) {
- if(Development.<Boolean>getProperty(DevelopmentKeys.LOGGER_ECHO, Bindings.BOOLEAN)) {
- System.err.println("Logger.logTrace: " + message);
- }
- }
-
- }
-
- /**
- * Log an info event.
- *
- * @param message message of the info
- * @param exception the exception, or <code>null</code>
- */
- public void logInfo(String message, Throwable exception) {
-
- if(!logger.isInfoEnabled()) return;
-
- // Errors are much more useful with a stack trace!
- if (exception == null) {
- exception = new RuntimeException();
- }
- logger.info(message, exception);
-
- if (Development.DEVELOPMENT) {
- if(Development.<Boolean>getProperty(DevelopmentKeys.LOGGER_ECHO, Bindings.BOOLEAN)) {
- System.err.println("Logger.logInfo: " + message);
- }
- }
-
- }
-
- /**
- * Log an error event.
- *
- * @param message message of the error
- * @param exception the exception, or <code>null</code>
- */
- public void logError(String message, Throwable exception) {
-
- if(!logger.isEnabledFor(Level.ERROR)) return;