org.apache.commons.logging.LogConfigurationException Java Examples
The following examples show how to use
org.apache.commons.logging.LogConfigurationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JCLogFactory.java From ymate-platform-v2 with Apache License 2.0 | 5 votes |
@Override public Log getInstance(final String name) throws LogConfigurationException { Log _logger = __LOGGER_CACHE.get(name); if (_logger == null) { _logger = new JCLogger(name); __LOGGER_CACHE.put(name, _logger); } return _logger; }
Example #2
Source File: CommonsLoggingListener.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates a <code>CommonsLoggingListener. Initializes its log factory. * @throws CheckstyleException if if the implementation class is not * available or cannot be instantiated. */ public CommonsLoggingListener() throws CheckstyleException { try { mLogFactory = LogFactory.getFactory(); } catch (LogConfigurationException e) { throw new CheckstyleException("log configuration exception", e); } mInitialized = true; }
Example #3
Source File: Resolver.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * constructor with <code>SymbolTable</code> to be resolved */ public Resolver(SymbolTable symbolTable) { super(symbolTable); try { mLogFactory = LogFactory.getFactory(); } catch (LogConfigurationException e) { System.out.println("log configuration exception" + e); } mInitialized = true; }
Example #4
Source File: CommonsLoggingListener.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates a <code>CommonsLoggingListener. Initializes its log factory. * @throws CheckstyleException if if the implementation class is not * available or cannot be instantiated. */ public CommonsLoggingListener() throws CheckstyleException { try { mLogFactory = LogFactory.getFactory(); } catch (LogConfigurationException e) { throw new CheckstyleException("log configuration exception", e); } mInitialized = true; }
Example #5
Source File: Resolver.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
/** * constructor with <code>SymbolTable</code> to be resolved */ public Resolver(SymbolTable symbolTable) { super(symbolTable); try { mLogFactory = LogFactory.getFactory(); } catch (LogConfigurationException e) { System.out.println("log configuration exception" + e); } mInitialized = true; }
Example #6
Source File: HttpRequestLog.java From hadoop with Apache License 2.0 | 4 votes |
public static RequestLog getRequestLog(String name) { String lookup = serverToComponent.get(name); if (lookup != null) { name = lookup; } String loggerName = "http.requests." + name; String appenderName = name + "requestlog"; Log logger = LogFactory.getLog(loggerName); boolean isLog4JLogger;; try { isLog4JLogger = logger instanceof Log4JLogger; } catch (NoClassDefFoundError err) { // In some dependent projects, log4j may not even be on the classpath at // runtime, in which case the above instanceof check will throw // NoClassDefFoundError. LOG.debug("Could not load Log4JLogger class", err); isLog4JLogger = false; } if (isLog4JLogger) { Log4JLogger httpLog4JLog = (Log4JLogger)logger; Logger httpLogger = httpLog4JLog.getLogger(); Appender appender = null; try { appender = httpLogger.getAppender(appenderName); } catch (LogConfigurationException e) { LOG.warn("Http request log for " + loggerName + " could not be created"); throw e; } if (appender == null) { LOG.info("Http request log for " + loggerName + " is not defined"); return null; } if (appender instanceof HttpRequestLogAppender) { HttpRequestLogAppender requestLogAppender = (HttpRequestLogAppender)appender; NCSARequestLog requestLog = new NCSARequestLog(); requestLog.setFilename(requestLogAppender.getFilename()); requestLog.setRetainDays(requestLogAppender.getRetainDays()); return requestLog; } else { LOG.warn("Jetty request log for " + loggerName + " was of the wrong class"); return null; } } else { LOG.warn("Jetty request log can only be enabled using Log4j"); return null; } }
Example #7
Source File: LogFactoryImpl.java From logging-log4j2 with Apache License 2.0 | 4 votes |
@Override public Log getInstance(@SuppressWarnings("rawtypes") final Class clazz) throws LogConfigurationException { return getInstance(clazz.getName()); }
Example #8
Source File: LogFactoryImpl.java From logging-log4j2 with Apache License 2.0 | 4 votes |
@Override public Log getInstance(final String name) throws LogConfigurationException { return adapter.getLogger(name); }
Example #9
Source File: RapidoidLogFactory.java From rapidoid with Apache License 2.0 | 4 votes |
@Override public Log getInstance(String name) throws LogConfigurationException { return new RapidoidLog(name); }
Example #10
Source File: RapidoidLogFactory.java From rapidoid with Apache License 2.0 | 4 votes |
@Override public Log getInstance(Class clazz) throws LogConfigurationException { return new RapidoidLog(clazz.getName()); }
Example #11
Source File: CommonsLogFactory.java From Openfire with Apache License 2.0 | 4 votes |
@Override public org.apache.commons.logging.Log getInstance(String string) throws LogConfigurationException { return log; }
Example #12
Source File: CommonsLogFactory.java From Openfire with Apache License 2.0 | 4 votes |
@Override public org.apache.commons.logging.Log getInstance(Class aClass) throws LogConfigurationException { return log; }
Example #13
Source File: JCLogFactory.java From ymate-platform-v2 with Apache License 2.0 | 4 votes |
@Override public Log getInstance(@SuppressWarnings("rawtypes") final Class clazz) throws LogConfigurationException { return getInstance(clazz.getName()); }
Example #14
Source File: HttpRequestLog.java From big-c with Apache License 2.0 | 4 votes |
public static RequestLog getRequestLog(String name) { String lookup = serverToComponent.get(name); if (lookup != null) { name = lookup; } String loggerName = "http.requests." + name; String appenderName = name + "requestlog"; Log logger = LogFactory.getLog(loggerName); boolean isLog4JLogger;; try { isLog4JLogger = logger instanceof Log4JLogger; } catch (NoClassDefFoundError err) { // In some dependent projects, log4j may not even be on the classpath at // runtime, in which case the above instanceof check will throw // NoClassDefFoundError. LOG.debug("Could not load Log4JLogger class", err); isLog4JLogger = false; } if (isLog4JLogger) { Log4JLogger httpLog4JLog = (Log4JLogger)logger; Logger httpLogger = httpLog4JLog.getLogger(); Appender appender = null; try { appender = httpLogger.getAppender(appenderName); } catch (LogConfigurationException e) { LOG.warn("Http request log for " + loggerName + " could not be created"); throw e; } if (appender == null) { LOG.info("Http request log for " + loggerName + " is not defined"); return null; } if (appender instanceof HttpRequestLogAppender) { HttpRequestLogAppender requestLogAppender = (HttpRequestLogAppender)appender; NCSARequestLog requestLog = new NCSARequestLog(); requestLog.setFilename(requestLogAppender.getFilename()); requestLog.setRetainDays(requestLogAppender.getRetainDays()); return requestLog; } else { LOG.warn("Jetty request log for " + loggerName + " was of the wrong class"); return null; } } else { LOG.warn("Jetty request log can only be enabled using Log4j"); return null; } }
Example #15
Source File: HttpRequestLog.java From hadoop-ozone with Apache License 2.0 | 4 votes |
public static RequestLog getRequestLog(String name) { String lookup = SERVER_TO_COMPONENT.get(name); if (lookup != null) { name = lookup; } String loggerName = "http.requests." + name; String appenderName = name + "requestlog"; Log logger = LogFactory.getLog(loggerName); boolean isLog4JLogger; try { isLog4JLogger = logger instanceof Log4JLogger; } catch (NoClassDefFoundError err) { // In some dependent projects, log4j may not even be on the classpath at // runtime, in which case the above instanceof check will throw // NoClassDefFoundError. LOG.debug("Could not load Log4JLogger class", err); isLog4JLogger = false; } if (isLog4JLogger) { Log4JLogger httpLog4JLog = (Log4JLogger) logger; org.apache.log4j.Logger httpLogger = httpLog4JLog.getLogger(); Appender appender = null; try { appender = httpLogger.getAppender(appenderName); } catch (LogConfigurationException e) { LOG.warn("Http request log for {} could not be created", loggerName); throw e; } if (appender == null) { LOG.info("Http request log for {} is not defined", loggerName); return null; } if (appender instanceof HttpRequestLogAppender) { HttpRequestLogAppender requestLogAppender = (HttpRequestLogAppender) appender; AsyncRequestLogWriter logWriter = new AsyncRequestLogWriter(); logWriter.setFilename(requestLogAppender.getFilename()); logWriter.setRetainDays(requestLogAppender.getRetainDays()); return new CustomRequestLog(logWriter, CustomRequestLog.EXTENDED_NCSA_FORMAT); } else { LOG.warn("Jetty request log for {} was of the wrong class", loggerName); return null; } } else { LOG.warn("Jetty request log can only be enabled using Log4j"); return null; } }
Example #16
Source File: LogFactoryImpl.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * <p>Construct (if necessary) and return a <code>Log</code> instance, * using the factory's current set of configuration attributes.</p> * * <p><strong>NOTE</strong> - Depending upon the implementation of * the <code>LogFactory</code> you are using, the <code>Log</code> * instance you are returned may or may not be local to the current * application, and may or may not be returned again on a subsequent * call with the same name argument.</p> * * @param name Logical name of the <code>Log</code> instance to be * returned (the meaning of this name is only known to the underlying * logging implementation that is being wrapped) * * @exception LogConfigurationException if a suitable <code>Log</code> * instance cannot be returned */ public Log getInstance(String name) throws LogConfigurationException { Log instance = (Log) instances.get(name); if (instance == null) { instance = newInstance(name); instances.put(name, instance); } return (instance); }
Example #17
Source File: LogFactoryImpl.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | votes |
/** * Convenience method to derive a name from the specified class and * call <code>getInstance(String)</code> with it. * * @param clazz Class for which a suitable Log name will be derived * * @exception LogConfigurationException if a suitable <code>Log</code> * instance cannot be returned */ public Log getInstance(Class clazz) throws LogConfigurationException { return (getInstance(clazz.getName())); }