org.apache.log4j.spi.OptionHandler Java Examples
The following examples show how to use
org.apache.log4j.spi.OptionHandler.
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: AppenderDynamicMBean.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public Object invoke(String operationName, Object params[], String signature[]) throws MBeanException, ReflectionException { if(operationName.equals("activateOptions") && appender instanceof OptionHandler) { OptionHandler oh = (OptionHandler) appender; oh.activateOptions(); return "Options activated."; } else if (operationName.equals("setLayout")) { Layout layout = (Layout) OptionConverter.instantiateByClassName((String) params[0], Layout.class, null); appender.setLayout(layout); registerLayoutMBean(layout); } return null; }
Example #2
Source File: SMTPAppender.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** Activate the specified options, such as the smtp host, the recipient, from, etc. */ public void activateOptions() { Session session = createSession(); msg = new MimeMessage(session); try { addressMessage(msg); if(subject != null) { msg.setSubject(subject); } } catch(MessagingException e) { LogLog.error("Could not activate SMTPAppender options.", e ); } if (evaluator instanceof OptionHandler) { ((OptionHandler) evaluator).activateOptions(); } }
Example #3
Source File: LayoutDynamicMBean.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public Object invoke(String operationName, Object params[], String signature[]) throws MBeanException, ReflectionException { if(operationName.equals("activateOptions") && layout instanceof OptionHandler) { OptionHandler oh = (OptionHandler) layout; oh.activateOptions(); return "Options activated."; } return null; }
Example #4
Source File: Log4jAppenderHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Activates the appender only if it's an {@link OptionHandler option handler}. */ public void activate() { if (appender instanceof OptionHandler) { ((OptionHandler) appender).activateOptions(); if (LoggingLogger.ROOT_LOGGER.isDebugEnabled()) { LoggingLogger.ROOT_LOGGER.debugf("Invoking OptionHandler.activateOptions() on appender %s (%s)", appender.getName(), appender.getClass().getCanonicalName()); } } }
Example #5
Source File: PropertyConfigurator.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
Appender parseAppender(Properties props, String appenderName) { Appender appender = registryGet(appenderName); if((appender != null)) { LogLog.debug("Appender \"" + appenderName + "\" was already parsed."); return appender; } // Appender was not previously initialized. String prefix = APPENDER_PREFIX + appenderName; String layoutPrefix = prefix + ".layout"; appender = (Appender) OptionConverter.instantiateByKey(props, prefix, org.apache.log4j.Appender.class, null); if(appender == null) { LogLog.error( "Could not instantiate appender named \"" + appenderName+"\"."); return null; } appender.setName(appenderName); if(appender instanceof OptionHandler) { if(appender.requiresLayout()) { Layout layout = (Layout) OptionConverter.instantiateByKey(props, layoutPrefix, Layout.class, null); if(layout != null) { appender.setLayout(layout); LogLog.debug("Parsing layout options for \"" + appenderName +"\"."); //configureOptionHandler(layout, layoutPrefix + ".", props); PropertySetter.setProperties(layout, props, layoutPrefix + "."); LogLog.debug("End of parsing for \"" + appenderName +"\"."); } } //configureOptionHandler((OptionHandler) appender, prefix + ".", props); PropertySetter.setProperties(appender, props, prefix + "."); LogLog.debug("Parsed \"" + appenderName +"\" options."); } registryPut(appender); return appender; }
Example #6
Source File: PropertySetter.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public void activate() { if (obj instanceof OptionHandler) { ((OptionHandler) obj).activateOptions(); } }
Example #7
Source File: PropertySetter.java From logging-log4j2 with Apache License 2.0 | 4 votes |
public void activate() { if (obj instanceof OptionHandler) { ((OptionHandler) obj).activateOptions(); } }
Example #8
Source File: PropertySetter.java From logging-log4j2 with Apache License 2.0 | 4 votes |
public void activate() { if (obj instanceof OptionHandler) { ((OptionHandler) obj).activateOptions(); } }