cancel
Showing results for 
Search instead for 
Did you mean: 

Log Configuration for a Web Dynpro application

Former Member
0 Kudos

Hallo,

I have tried to configure the logging in the wd project but something is wrong couse no file is written.

In the wdDoInit of my view x.y.z.view.GetRunnableProcessView I have put the following:

//directs log messages to a file

logger.addLog(new FileLog(wdContext.currentPropertyElement().getLogFilename()));

//set severity

logger.setEffectiveSeverity(Severity.ALL);

logger.entering("entering string");

logger.exiting("exiting string");

My log-configuration.xml is the following:

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

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

<log-configuration>

<log-controllers>

<log-controller

effective-severity="PATH"

name="x.y.z.view.GetRunnableProcessView"/>

</log-controllers>

</log-configuration>

In the visualAdmin >> Log Configuration Properties, the ForceSingleTraceFile is set to "NO".

The problem is that in the Log Configurator service in Visual admin I don't find my location tree and no log file is written.

Could somebody help me please?

Thanks,

regards

Andrea

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hallo,

the best way is to implement log4j. That is easy to implement and to configure.

Here is the link for download. http://logging.apache.org/log4j/1.2/download.html

Than you have to reference the log4j???.jar in your Application.

Next is to configure your properties (xml) file.

  1. the root-logger level ERROR

log4j.rootLogger=ERROR, WD

  1. now we attemp an appender to the conosole

log4j.appender.WD=org.apache.log4j.ConsoleAppender

#For this appende generade a Layout

log4j.appender.WD.layout=org.apache.log4j.PatternLayout

  1. date shown in ISO-Format ISO-8601

log4j.appender.WD.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

#for all class an packages "com.company.tests" the level DEBUG

log4j.logger.com.company.tests =DEBUG

********************

Implement this in your Application

PropertyConfigurator.configureAndWatch( "log4j.properties", 60*1000 );

put this in the begin others and end others

private static final Logger log = Logger.getLogger(<Your Company ControllerName>.class);

now you are able to log with

log.debug("Tests");

in your application

Former Member
0 Kudos

Thanks but my company don't want use log4j. they want use the sap logger...

Stefan-EA
Contributor
0 Kudos

Take a look at this [doc|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/0c6ada90-0201-0010-4397-b6dcb6e661a2] for setting up and using sap logger.

Once configured, just use the already defined logger in WDP

eg: logger.errorT()