Skip to Content
avatar image
Former Member

println, printStackTrace output in an EJB... Where is it going?

I'm not making much progress in debugging an EJB application because System.out.println doesn't show in the console, and neither does printStackTrace. Even if I type 'throw new Exception("look at this")' in code that I know runs, I don't see "look at this" anywhere in the console output. And when I tried to debug, I see some $Proxy class, and it says it has no source code for that (but I know it's my bean code that it's running).

So that's my saga for the last hour. How am I SUPPOSED to be getting feedback on the running of my beans? Is there an example of logging or something that I should be looking at?

By the way, I've found my way into the j2ee admin and the log configuration, and I may need help with that later. But for now, how is one supposed to create entries in those logs?

Edit:

I have tried:

Logger.getLogger("UserSession").log(Level.ALL, "testing
 the logger user session");

but that results in a failed deployment because of some credentials problem. So I tried:

Logger.getLogger("AppTracing").log(Level.ALL, "testing 
the logger app tracing");

and that resulted in a deployment, and the method with this line runs, but there is no file on my machine matching *.trc with a current time stamp. By the way, "AppTracing" is one of the defined log controllers, and I tried both a green dot and a blue dot in the engine admin console. It's linked to service_apptracing_log_invocations, so the file is supposed to be called ./log/system/performance/apptracing_invocations.log. I don't know what the root (.) is, so I searched the whole drive for *.log, but nothing turned-up.

Ideas? Does anyone have a log or trace that actually works?

Thanks.

Message was edited by: Dale Seng

Message was edited by: Dale Seng

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Jul 05, 2004 at 01:44 PM

    How about using NDev Studios built in debugging capabilities? I just linked there in a post before:

    http://help.sap.com/saphelp_nw04/helpdata/en/66/547f09281d464b951c9a3a6b06a12d/frameset.htm

    That shows you how to do it.

    If you really need to look into logs, you should use logviewer, availbale from Visual Administrator or in it's standalone version.

    Regards,

    Benny

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Benny. I've been able to run the debug from the tutorial. And in fact my first thought (ahead of log files) was to use the debug. I set a breakpoint in my EJB, and it ran and stopped at the breakpoint. Everything sounds great so far, but the problem was it was running some derived class ($Proxy) that apparently had no source code (at least it didn't show for me, as I have it configured).

      Then I tried to figure-out logging. I looked through the help files, but wasn't able to make the connection between what to put into the code, and what to do in the visual admin. I could see some things in the logviewer, just nothing that I was trying to write.

      So for now I'm just writing to a file... until I figure out debugging or logging.

      Dale

  • avatar image
    Former Member
    Jul 06, 2004 at 08:26 PM

    I also have similar problems using Logging with SAP Netweaver. So far I could write to a file and to the console by using the class "com.sap.tc.logging.Location" or "com.sap.tc.logging.Category".

    SAP suggests to use Location for trace mesages and the Category for distinguished problem areas such as networking, ...

    Add the jars (loggingStandard.jar, logging.jar)from folder "\JDT\eclipse\plugins\com.tssap.sap.libs.logging\lib" to the build path of your project

    Then try this coding:

    private static final Location loc = Location.getLocation("com.vendor.package.ClassName");

    loc.setEffectiveSeverity(Severity.PATH);

    loc.addLog(new ConsoleLog()); //for logging on the console

    loc.addLog( new FileLog("D:
    temp
    testOutput.log")); //for logging in a file

    String method = "method_name";

    String msg = "message";

    loc.entering(method);

    loc.fatalT(msg);

    loc.infoT(method);

    ...

    There is also the posibilty to configure the Logging in the file log-configuration.xml of an EAR project.

    Thats probably is the correct way to use it. Unfortunately I dont have any examples for that. At the moment I am playing around to find the right way to use the SAP Logging.

    Best Regards,

    Trian

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 06, 2004 at 08:37 PM

    Have a look on this page for further information about the SAP Logging API.

    http://help.sap.com/saphelp_nw04/helpdata/en/4a/c3953ff1353c17e10000000a114084/content.htm

    Regards,

    Trian

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Benny Schaich-Lebek

      Thanks Benny, for the follow-up. I finally gave up and started appending messages to a FileWriter. And at the moment I'm not doing development work on the platform. But I think this is one area where we are in need of a cookbook; there's configuration, enabling, and using specific classes in specific ways, and all of this needs to be coordinated. If I spent a long while with the help text, I might be able to get it, but it would be more efficient to see an example.

      Dale