Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Webdynpro trace & log

Hi All,

I'm trying to customize the webdynpro logger in design time.

I've created the log-configurator.xml and defined all its attributes. As for my understanding after deploying the project, all the locations\formatters are supposed to be in the visual admin console.

I also set the "SingleTraceFile" to NO.

Is there a step-by-step tutorial for this?

Why are my configurations aren't deployed?

Aviad

Former Member
Former Member replied

Hi,

Configuring application logs:

Configuration is task for server administrator. create configuration file for each component. Right click on WebDynpro project and select "Create Log Configuration File". Click on the "Log Controller", select Log Controllers tree and Add new controller. Enter "Controller name" (according to location name you want to use in your application). (If you want to log language-independent messages use "Bundle name" to specify resource bundle.) Select Effective severity you want to use. You can also specify minimum and maximum severity to be used with this controller (server will not use severity out of this range).

Make sure that log-configuration.xml is placed inside META-INF directory of your EAR (or in descriptors directory of your SDA). If not then your log-configuration.xml will not be loaded into server configuration at deploy time.

All log message are stored in XML files.

You probably want separated XML file created for each application (or even each service). Go to the Log Formatter tab of your log-configuration.xml and Add new formatter into the root of tree. Set Name and Type appropriately. Then got to the Log Destination tab and Add new destination to the root of tree. Set Name, Type (FileLog) and Pattern (filename + path relative to c:\usr\sap\J2E\JC00\j2ee\cluster\server0\). Choose Formatter Reference to previously created formatter. In Log Controllers tab in the tree find Referenced Destinations and Add your destination associated to LOG (PUBLIC log in Visual administrator). You will probably do these things also in Visual Administrator (if log-configuration.xml isn't placed inside META-INF directory of your EAR). Even with this setting your deployed application will not work as expected until you set ForceSingleTraceFile=No and restart server.

Sample code

public void wdDoInit()

{

//@@begin wdDoInit()

final String method="wdDoInit()";

loc.entering(method);

if(loc.beDebug()){

Integer a=new Integer(1+1);

loc.debugT(method,"Result is {0}",new String[]{a.toString()});

}

loc.debugT("Just wasting time :-)");

if(loc.beError())

loc.errorT("xxx");

//sending problem to administrator

Category.APPS_COMMON_CONFIGURATION.errorT(loc,MessageE002);

loc.debugT(Category.APPS_COMMON_CONFIGURATION,"some message",new String[]{"debug"}); loc.warningT("qvradf"); loc.errorT(method,"Someone stole my data"); String storage="hard disk"; loc.errorT(method,"Data stolen from ",new String[]);

loc.fatalT(Category.SYS_DATABASE,method,MessageF007);

loc.exiting();

//@@end

}

//@@begin others

private static final Location loc = Location.getLocation(LogtestView.class);

private static final String MessageE002 = "E002: Input parameter can't be handled.";

private static final String MessageF007 = "F007: Data stolen.";

//@@end

Regards

Suresh

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question