To give you a quick help here is the source:
import java.net.URL;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.xml.DOMConfigurator;
import org.openarchitectureware.workflow.WorkflowContext;
import org.openarchitectureware.workflow.issues.Issues;
import org.openarchitectureware.workflow.lib.AbstractWorkflowComponent2;
import org.openarchitectureware.workflow.monitor.ProgressMonitor;
/**
* Use this workflow component to initialize the logging subsystem.
*
* <h2>Example</h2>
*
* <pre>
* <component
class="gts.ise.common.oaw.workflow.LoggingConfiguratorComponent">
* <log4jConfig value="log4j.xml"/>
* </component>
* </pre>
*
*/
public class LoggingConfiguratorComponent extends AbstractWorkflowComponent2 {
private static final Log LOG =
LogFactory.getLog(LoggingConfiguratorComponent.class);
private String log4jConfig;
private URL log4jConfigURL;
@Override
protected void checkConfigurationInternal(Issues issues) {
if (log4jConfig!=null) {
log4jConfigURL =
Thread.currentThread().getContextClassLoader().getResource(log4jConfig);
if (log4jConfigURL==null) {
issues.addError("Invalid URL specified for
'log4jConfig'");
}
}
}
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor mon,
Issues issues) {
if (log4jConfigURL!=null) {
if (log4jConfig.endsWith(".xml")) {
DOMConfigurator.configure(log4jConfigURL);
} else if (log4jConfig.endsWith(".properties")) {
PropertyConfigurator.configure(log4jConfigURL);
}
LOG.info("Configured log4j with "+log4jConfig);
}
}
/**
* Sets the log4j configuration to be used.
* @param log4jConfig Resource URL of the log4j configuration. The URL
must end with
* file extensions ".xml" or ".properties". The referred configuration
must be loadable
* by the current thread's context classloader.
*/
public void setLog4jConfig(String log4jConfig) {
this.log4jConfig = log4jConfig;
}
}
----- Original Message -----
From: "Polly C. Chang" <[email protected]>
To: [email protected]
Sent: Monday, June 29, 2009 4:51:33 PM (GMT+0100) Europe/Berlin
Subject: Re: [Fornax-developer] logging with fornax-oaw-m2-plugin
------------------------------------------------------------------------------
------------------------------------------------------------------------------
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer