Précédent: Configuring
Plexus Components |
Haut: Configurations |
Suivant: Components |
Say, we want to use Log4j logging for the log messages in our Website monitor component - how could we replace the default logging implementation?
Before we demonstrate how logger can be swapped, some notes on how logging is setup up for a Plexus component
protected InputStream getCustomConfiguration() throws Exception {
InputStream is = this.getClass ().getClassLoader ().getResourceAsStream ("org/codehaus/plexus/PlexusTestContainerConfig.xml");
return is;
}
<!-- Override the configuration that is used by the PlexusTestCase to create a Container instance -->
<plexus>
<components>
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>
org.codehaus.plexus.logging.log4j.Log4JLoggerManager
</implementation>
<configuration>
<appenders>
<appender>
<id>rolling</id>
<threshold>DEBUG</threshold>
<type>org.apache.log4j.RollingFileAppender</type>
<conversion-pattern>
%-4r [%t] %-5p %c %x - %m%n
</conversion-pattern>
<properties>
<property>
<name>file</name>
<value>${plexus.home}/logs/plexus-rolling.log</value>
</property>
<property>
<name>append</name>
<value>true</value>
</property>
<property>
<name>maxBackupIndex</name>
<value>10</value>
</property>
<property>
<name>maxFileSize</name>
<value>20</value>
</property>
</properties>
</appender>
</appenders>
</configuration>
</component>
</components>
</plexus>
Précédent: Configuring
Plexus Components |
Haut: Configurations |
Suivant: Components |