Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
hofmann
Active Contributor
0 Kudos

WebDynpro Java (WDJ) offers the ability to write the logs of an application to a specific log. Instead of writing it to the same logs as the portal - ex.: default.trc - you can define your own file for every application, making it very easy for you, the administrator and the developer to analyze the application.

In your WDJ application, you define a log category. This category will receive all the logs of your application. This looks like this:

private static final com.sap.tc.logging.Category realLogger = com.sap.tc.logging.Category.getCategory (Category.APPLICATIONS, "/Portal/Myapp");

This is done by the developer. The developer has to communicate this category to the NW AS Java Administrator so he can configure the application server. To do so, follow these steps:

 1. Deploy the WDJ application.
 2. Configure the Application Server. Open Visual Administrator and connect to the server.
  a. Service: Log Configurator
   
  b. Click on "To advanced mode"
  c. Select the tab "Destinations"
  d. Select "New"
   
  e. Configure the destination.
  The server will create the file specified in File Name Pattern when the application is writing to the log for the 1st time. This file does not needed to be created first.
 
  •  Name: company.com/Myapp
  • Type: FileLog
  • File Name Pattern: ./log/applications/company.com/myapp/mylog.trc
  • Maximum File Size: 10485760
  • Number Of Files: 10
  f. After the destinations has been created, you need to specify a formatter. The formatter takes care on how to format the resulting log output.
 
  •  Click on "Add"
  • Create an anonymous formatter by selecting "Anonymous"
  • Select "ListFormatter. You can also create your own formatter or select a different anonymous formatter.
   
  g. Switch to "Categories"
   
  h. Navigate inside the tree to: Applications -> Portal -> Myapp. This path is specified by the developer. When he created the log category in the WDJ application, he specified (in our example!):
  private static final com.sap.tc.logging.Category realLogger = com.sap.tc.logging.Category.getCategory (Category.APPLICATIONS, "/Portal/Myapp");
  This means that the specified category is Application and the path there is Portal and Myapp. Therefore, this shows up in the VA as: Applications -> Portal -> Myapp
  * if this entry isn't already there, you can simply create it.
  i. Select "Add" in the "Destinations" tab
  j. Select the destination created above (company.com/Myapp)
   
  k. Click on "Save" and "Apply to all server nodes"
   
 3. Test the configuration in the portal
  a. Access Content Administration -> Web Dynpro
  b. Select the component in the deployed component section and run the application
 4. Verify the log
 In the portal server, check that the log was created in the correct location and that the Web Dynpro application is writing to it. As the location (./log/applications/company.com/Myapp/mylog.trc) is relative, the full path is:
  /netweaver/sap/[INST]/JC00/j2ee/cluster/server0/log/applications/company.com/Myapp/mylog.trc
  or
  /usr/sap/[INST]/JC00/j2ee/cluster/server0/log/applications/company.com/Myapp/mylog.trc
  Check the content with notepad, less, more, tail, NWA, Visual Adminstrator or another program.
3 Comments
Labels in this area