Hi,
We also use custom loggers for our applications.
A log4j jar file alredy exists by default in [b]webMethods7/common/lib/ext/log4j.jar[/b]. I [b]think [/b]MWS & IS uses this jar.
In order to use a custom logger for our applications we have made the following configurations:
- in the file [b]MyApp\WebContent\WEB-INF\web.xml[/b] add the following listener:
<listener>
<listener>com.myapp.util.MyServletContextListener</listener>
</listener>
- create the class [b]com.myapp.util.MyServletContextListener[/b]:
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.PropertyConfigurator;
public class MyServletContextListener implements ServletContextListener {
public void contextDestroyed(ServletContextEvent arg0) {
// do nothing
}
public void contextInitialized(ServletContextEvent arg0) {
try {
// Set Logggingproperties with Configfile
PropertyConfigurator.configureAndWatch(arg0.getServletContext().getRealPath(
"/WEB-INF/" + "myLog4j.properties"),5 * 1000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
- create your own [b]myLog4j.properties[/b] file
- use the logger in your application:
private static Logger myLogger = Logger.getLogger(Foo.class);
br,
Vlad
#webMethods-BPMS#webMethods#MWS-CAF-Task-Engine