Skip to Content
author's profile photo Former Member
Former Member

How to use application logger ?

Hi,

I have created a JSPDynPage application that I've deploy ion my portal (EP6 SP13)

I want to use logger to manage it.

For this, I've read many documentation but I can not find 2 documentations which are saying the same thing...

😊

Actually:

/* I created a location in each class */

private static final Location LOCATION = Location.getLocation(MyClass.class);

/* I reference the application category */

private static final Category CATEGORY = Category.getCategory(Category.APPLICATIONS, Constants.APPLICATION_NAME);

/* And I use this as: */

CATEGORY.infoT(LOCATION, "doInitialization", "User logged in", new Object[] { m_timeManagment.getFirstName()}); /* And: */ LOCATION.infoT("doInitialization", "User started transaction", new Object[] { m_timeManagment.getFirstName()});

But I think I must do other think ...

Like for example create a log-configuration.xml file in my application folder (under "logger" repository?)

Should I reference it in the portalapps.xml ?

...

Can someone tell me exactly how to do, please ?

Thanks,

Fabien

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 01:46 PM

    Hi,

    I give more information...

    I add a log-configuration.xml file into my application.

    I put it in the dist/PORTAL-INF/logger directory of my application.

    And I write a log-formatter,log-destination and log-controller as said in the "http://help.sap.com/saphelp_nw04/helpdata/en/5f/e5de3f68d48f15e10000000a155106/frameset.htm" documentation

    Do I have to define this log file (log-configuration.xml) in the portalapp.xml definition file ?

    How can I use log defined into log-configuration.xml in my java code ?

    Thanks,

    Fabien

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 29, 2005 at 12:51 PM

    And if you preferred, Fabien, the <u>com.sap.tc.logging</u> API to the EP's <u>com.sapportals.portal.prt.logger</u> API, then you could use it in your code (just as you currently do), and <b>manually</b> define the corresponding location/category inside the Log Configurator Service of the J2EE Engine. As Detlev said, in fact, the log-configuration.xml file is useful just for J2EE applications.

    So if your application super-package is, for instance, com.company.yourapplication, you could add a new location under <i>Log Configurator -> Locations -> com</i>, with name com.company.yourapplication, set its desired level, and save.

    Davide

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 05:12 PM

    Hi,

    I have a problem with the definition and the use of log-configuration.xml file.

    Here, I use the log-configuration.xml file...

    But the code seems OK but I don't see any log or location/category in the Log viewer

    My log-configuration.xml is:

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

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

    <log-configuration>

    <log-formatters>

    <log-formatter

    name="DefaultFormatter"

    pattern="%24d %l [%s]: %m"

    type="TraceFormatter"/>

    </log-formatters>

    <log-destinations>

    <log-destination

    count="10"

    effective-severity="INFO"

    limit="1000000"

    name="application_log"

    pattern="./log/applications/TimeManagmentWithLog/defaultTrace.%g.trc"

    type="FileLog">

    <formatter-ref name="DefaultFormatter"/>

    </log-destination>

    </log-destinations>

    <log-controllers>

    <log-controller

    effective-severity="INFO"

    name="com.eurocopter.portal.time.management.process">

    <associated-destinations>

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

    </associated-destinations>

    </log-controller>

    <log-controller

    effective-severity="INFO"

    name="/Application/TimeManagmentWithLog">

    <associated-destinations>

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

    </associated-destinations>

    </log-controller>

    </log-controllers>

    </log-configuration>

    So, I define a location: com.eurocopter.portal.time.management.process

    And a category: /Application/TimeManagmentWithLog

    And the destination of the log file: ./log/applications/TimeManagmentWithLog/defaultTrace.%g.trc

    And in the java code, I use:

    package com.eurocopter.portal.time.management.process;

    ...

    private static final Location LOCATION = Location.getLocation(TimeManagementProcess.class);

    private static final Category CATEGORY = Category.getCategory(Category.APPLICATIONS, Constants.APPLICATION_NAME);

    ...

    CATEGORY.infoT(LOCATION, "doInitialization", "User logged in", new Object[] { m_timeManagment.getFirstName()}); LOCATION.infoT("doInitialization", "User started transaction", new Object[] { m_timeManagment.getFirstName()});

    I would thinking this creates the logfile in the sepcified destination and that I can see the category and the location in log Configurator..

    But nothing happens...

    Did I do something wrong ?

    Thanks,

    Fabien

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 03:33 AM

    Fabien

    This is probably a naive question but have you looked at whether "INFO" logging will work on your system. I know with the system default log levels can be turned off ie on our sytem INFO and warning are off so logs don't post.

    I don't know about the Application log though. I want to learn how to use it myself so very interested in the final solution.

    Liz

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Detlev Beutner

      Hi,

      I've created a new Enterprise Application Projet into which I put a Web Module project (Standar J2EE application).

      In myEnterprise Application Projet, I've added a log-configuration.xml file.

      But when I deploy the .ear into the SAP J2EE Engine, nothing happen: I can not see the new Location and Category in the visual Administrator.

      When are they created? When Deployment? After ?

      Thanks,

      Fabien

      Thanks,

      Fabien

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.