cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using the SAP logging API

Former Member
0 Kudos

Hi all,

i am using the SAP WAS 640 SP9 and want to use the SAP logging API in my app but it doesn´t work.

I configuered a log-configuration.xml and used the code examples from the help portal:

The following is a code snippet from a session bean

protected static final Location loc = Location.getLocation("de.pta.sap.was.ag.Node");

public List getSchueler(String name) throws ApplicationException{

String method = "announce(java.lang.Object)";

loc.entering(method);

List schuelerListe = null;

try {

loc.debugT(method, "Connecting to …");

setConnection();

...

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

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

<log-configuration>

<log-formatters>

<log-formatter

name="ag_formatter"

pattern="%24d %-60l %s: %m"

type="TraceFormatter"/>

</log-formatters>

<log-destinations>

<log-destination

effective-severity="DEBUG"

name="ag_app_log"

pattern="./log/anwendungen/ag/ag.log"

type="FileLog">

<formatter-ref

name="ag_formatter"/>

</log-destination>

<log-destination

name="ag_app_log_trace"

type="ConsoleLog"/>

</log-destinations>

<log-controllers>

<log-controller

effective-severity="DEBUG"

name="ag_controller">

<associated-destinations>

<destination-ref

association-type="LOG"

name="ag_app_log_trace"/>

<destination-ref

association-type="LOG"

name="ag_app_log"/>

</associated-destinations>

</log-controller>

</log-controllers>

</log-configuration>

The Visual Administrator only shows the the destination ag_app_log_trace (Services => Log Configurator => Locations) for the controller

ag_controller. I tried to add the the destination ag_app_log (which is shown at the destinations list) and saved but this shows no effect.

Every time i open the LogConfiguratior i get the old configuration and there is no log file build while testing the app.

Can anybody help me?

Thanks

Christian

Accepted Solutions (1)

Accepted Solutions (1)

Jeff-Gebo
Advisor
Advisor
0 Kudos

Hi Christian,

You should name your log controller: /Applications/<your name>

instead of the name ag_controller use: /Applications/ag_controller

If you were using the tracing api (Locations), then you would have a name similar to this: com.sap.test

Where the class that is doing the tracing is in the com.sap.test package.

Hope this helps!

Cheers,

Jeff

Former Member
0 Kudos

Hi Jeff,

thanks for the help.

I changed the settings and it looks a little better at the Visual Administrator but there isn´t a generated log file anyway.

Do i have to change some global settings to activate the FileLog? There is no hint in the documentation.

Regards

Christian

Former Member
0 Kudos

Hi Jeff,

I found your logging and tracing pesentation and it is really helpful.

Trying to start the configtool i get the following error:

Secure Store lib Dir does not exist D:\usr\sap\J2E\SYS\global\security\lib\tools

The datybase settings are:

Secure Store File: D:\usr\sap\J2E\SYS\global\security\data\SecStore.properties

Secure Store Key File: D:\usr\sap\J2E\SYS\global\security\data\SecStore.key

System Name: J2E

Secure Store Lib: D:\usr\sap\J2E\SYS\global\security\lib

Rdbms connections: jdbc/pool/J2E

Rdbms driver location: D:\sapdb\programs\runtime\jar\sapdbc.jar

Rdbms initial connections: 1

Rdbms mx connections: 5

Thanks for Help

Christian

Jeff-Gebo
Advisor
Advisor
0 Kudos

Hi Christian,

For tracing you need to name the controller the package name of the class you are going to tracing in. Instead of the controller name being ag_app_log_trace, it should be in your case: de.pta.sap.was.ag

Hopefully this fixes the problem you are having. There aren't any settings for using File Log...if this doesn't work I could email you a simple app that does work.

Cheers,

Jeff

Former Member
0 Kudos

Hi Jeff,

trying the new controller and/or destination name, the logging does not work

Could you email me your little app so i can figure out where i do the wrong settings? (christian.schneider@pta.de)

Regards,

Christian

Jeff-Gebo
Advisor
Advisor
0 Kudos

Hi Christian,

I just sent you the simple logging App. For others out there who maybe interested here is a valid log-configuration.xml:

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

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

<log-configuration>

<log-destinations>

<log-destination

count="3"

effective-severity="ERROR"

limit="1000"

name="TraceFile"

pattern="./log/applications/sap.com/j1/LoggingDemoApp/default.trc"

type="FileLog"/>

</log-destinations>

<log-controllers>

<log-controller

effective-severity="ERROR"

name="com.sap.j1.loggingdemo">

<associated-destinations>

<destination-ref

association-type="LOG"

name="TraceFile"/>

</associated-destinations>

</log-controller>

</log-controllers>

</log-configuration>

Former Member
0 Kudos

Hi Christian,

since SP4 of J2EE Engine 6.30 all trace message go into the defaultTrace.trc file.

See SAP Note 733903 how to change that. Only recommended for development!!

"This can be achieved by

modifying two properties of the "Log Manager" kernel component on the

respective cluster node.

If "ForceSingleTraceFile" is set to NO, then this functionality is

entirely disabled and the traces are redirected to the destinations

specified in the log-configuration.xml."

Regards, Karsten

Former Member
0 Kudos

Hi Karsten,

thanks for the advice. I found a similar hint at a presentation about logging and tracing written by Jeff Gebo but i´m faacing troubles starting the config tool. I always get an error trying to start thr tool. The error is described above (Secure Store lib Dir does not exist).

Any hint will be appreciated

Christian

Former Member
0 Kudos

Christian, you have to apply these settings in the visual administrator. So it doesn't matter if your config tool doesn't start

Former Member
0 Kudos

Hi Karsten,

i changed the settings in the visual administrator, now the logging works fine. Wonder why this setting isn´t mentioned in the documents.

Thanks for your quick answers

Christian

Answers (0)