List of usage examples for org.apache.commons.logging Log getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.jboss.as.test.integration.osgi.logging.bundle.LoggingDelegate.java
public static void assertCommonsLogging(String message) { org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggingDelegate.class); String loggerClass = log.getClass().getName(); if ("org.apache.commons.logging.impl.SLF4JLocationAwareLog".equals(loggerClass) == false) throw new IllegalStateException("Unexpected logger: " + loggerClass); log.info("*******************************************"); log.info("* jcl: " + message); log.info("*******************************************"); }
From source file:org.nanoframework.commons.support.logging.JakartaCommonsLoggingImpl.java
public JakartaCommonsLoggingImpl(final Log logger) { Assert.notNull(logger);// ww w .j a va 2 s .c o m this.logger = logger; setLoggerName(logger.getClass().getName()); }
From source file:org.pentaho.big.data.kettle.plugins.job.JobEntryUtils.java
public static Logger findLogger(String logName) { Log log = LogFactory.getLog(logName); if (log instanceof org.apache.commons.logging.impl.Log4JLogger) { Logger logger = ((org.apache.commons.logging.impl.Log4JLogger) log).getLogger(); if (logger == null) { throw new IllegalArgumentException("Logger does not exist for log: " + logName); }/* ww w . j ava 2 s .c o m*/ return logger; } else if (log == null) { throw new IllegalArgumentException("Unknown log name: " + logName); } else { throw new IllegalArgumentException("Unsupported logging type: " + log.getClass()); } }
From source file:org.xerela.apache.commons.internal.CommonsActivator.java
/** {@inheritDoc} */ public void start(BundleContext context) throws Exception { // Load commons logging configuration from {osgi.configuration.area}/commons/logging/commons-logging.properties String commonsLogging = context.getProperty("osgi.configuration.area").replace(" ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (commonsLogging == null) { throw new RuntimeException("Unable to activate: osgi.configuration.area property is not defined."); //$NON-NLS-1$ }/*from w w w . ja v a 2 s. c om*/ File file = new File(URI.create(commonsLogging + COMMONS_LOGGING_PROPERTIES)); if (file.exists()) { InputStream is = new FileInputStream(file); System.getProperties().load(is); is.close(); } else { System.getProperties().load(context.getBundle().getResource(COMMONS_LOGGING_PROPERTIES).openStream()); } // Force commons logging initialization Log log = LogFactory.getLog(CommonsActivator.class); log.debug("Apache Commons Logging initialized using logger: " + log.getClass().toString()); //$NON-NLS-1$ }
From source file:powermock.examples.logging.JclUser_JMockit_Test.java
@Test public void assertJclMockingWorks() { JclUser tested = new JclUser(); Log logger = Deencapsulation.getField(JclUser.class, Log.class); assertTrue(Proxy.isProxyClass(logger.getClass())); assertEquals("jcl user", tested.getMessage()); }