Skip to Content
0
Former Member
Oct 25, 2004 at 09:59 AM

How to log to a file using the log-configuration.xml?

151 Views

Hello *,

I created following log-configuration.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE log-configuration SYSTEM "log-configuration.dtd">

<log-configuration>

<log-formatters>

<log-formatter name="DefaultFormatter" pattern="%25d %-60l %s: %m" type="TraceFormatter"/>

</log-formatters>

<log-destinations>

<log-destination count="10" effective-severity="ALL" limit="1000000" name="DefaultDestination" pattern="FDLB_GUI.%g.trc" type="FileLog">

<formatter-ref name="DefaultFormatter"/>

</log-destination>

</log-destinations>

<log-controllers>

<log-controller effective-severity="ALL" maximum-severity="FATAL" minimum-severity="DEBUG" name="DefaultController">

<associated-destinations>

<destination-ref association-type="LOG" name="DefaultDestination"/>

</associated-destinations>

</log-controller>

</log-controllers>

</log-configuration>

From a Web Dynpro view I want to use the log-controller. I'm using the default logger:

/**

  • Logging location.

*/

private static final com.sap.tc.logging.Location logger =

com.sap.tc.logging.Location.getLocation(EinstiegView.class);

In the wdInit method I want to log a simple message:

public void wdDoInit()

{

//@@begin wdDoInit()

logger.setEffectiveSeverity(com.sap.tc.logging.Severity.ALL);

logger.fatalT("test logging to new file logger");

//@@end wdDoInit()

}

I see the message in the defaultTrace.0.log, but my own log file doesn't appear.

How to address the log-controller of my log-configuration.xml?

Thanks in advance,

Jürgen Dufner