cancel
Showing results for 
Search instead for 
Did you mean: 

How to inlcude logging.jar

Former Member
0 Kudos

Hi,

I want to use the SAP logging API for Java. The available tutorial is a very good information resource how to use it. But if I insert logging statements to my code I'm not able to build my project any more. Ok it's because of a missing link to the library logging.jar. But how to include this library in the NW Developer Studio.

First I tried to include the logging via: Add/Remove Addition libraries ... --> com.sap.tc.logging. But this points to the library "SAP_SYSTEM_ADD_LIBS ... loggingStandard.jar". And thus does not contain the needed classes.

Then I tried to include the jar via:

<project> --> Propertied --> Java Build Path --> Add Variable --> SAP_LOGGING_LIB_HOME

But this variable does not point to a *.jar. So there was not change.

Finally I change the variable SAP_LOGGING_LIB_HOME so that it points now to the logging.jar. And everything is fine. But is this be the right way to modify the standard variables of the Developer Studio?

Does anybody have an idea how to include the logging.jar library in a proper way?

Kind Regards,

Heiko

Accepted Solutions (0)

Answers (3)

Answers (3)

prasannakrishna_mynam
Contributor
0 Kudos

Hello Heiko,

Try this step-by-step procedure.

1) Go to Project->properties ->Java Buildpath->Libraries

2) Once your into that click on AddVariable button

3) Provide this path SAP_LOGGING_LIB_HOME/lib/logging.jar

(or) you can browse this manually by click ADD JARs, follow this path

..SAP/IDE/IDE70/eclipse/plugins/com.tssap.sap.libs.logging_2.0.0/lib/logging.jar

There you are, you will get your .jar, All the best...

Regards..

Krishna..

0 Kudos

Dear Heiko,

Please provide me your tutorial on logging.

Kind Regards

Sanjay

Vlado
Advisor
Advisor
0 Kudos

Hi Heiko,

The second way you tried to do it is the right way. When you select the variable SAP_LOGGING_LIB_HOME there is a tip below: "Click 'extend' to choose an archive inside the folder". Then you have to select the logging.jar from the 'lib' folder in the 'Variable Extension' window and you're done.

As for using the logging API at runtime (after the application is deployed), keep in mind that you have to declare a reference to the logging library in the application-j2ee-engine.xml.

Hope that helps,

Vladimir

Former Member
0 Kudos

Hi Vladimir,

> The second way you tried to do it is the right way.

> When you select the variable SAP_LOGGING_LIB_HOME

> there is a tip below: "Click 'extend' to choose an

> archive inside the folder". Then you have to select

> the logging.jar from the 'lib' folder in the

> 'Variable Extension' window and you're done.

in this case the library logging.jar is automatically included in the EAR. So if the jar is part of the EAR why do I have to set a reference to com.sap.tc.logging, too.

I suppose that the included jar is used instead of the reference in my program.

Best Regards,

Heiko

Vlado
Advisor
Advisor
0 Kudos

Hi Heiko,

You're right. Actually, the logging.jar shouldn't be automatically included in the EAR, it should be added only to the build path of the EJB module project. But this "feature" comes from Eclipse and it's inherited by the NWDS. In the future releases of NWDS based on Eclipse 3 you'll have the possibility to specify which projects and classpath variables are ignored, i.e. they're not to be included in the archive.

Currently as a workaround you can do the following:

- in Properties\Java Build Path\Libraries click on "Add Variable..." and select the SAP_USER_ADD_LIBS variable

- click on "Edit..." -> "Variable..." -> "Edit..." and adjust the path to the logging.jar

- build the EJB archive and the Application archive.

This way the logging.jar will be added only to the build path but not in the EAR file too.

Best regards,

Vladimir