• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

log4j in eclipse enterprise application project

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse 3.3.1
ObjectWeb Lomboz for JavaEE Development Version: 3.3
Log4j 1.2.15
Java JEE1.4

I am trying to setup logging in my project correctly for my enterprise application.
I have three modules:
Application client
EJB
Utility

These are all module dependencies for my root project folder.

So if i have logging in each module where does the log4j.properties file go? Does it have to go into the src directory of each project or can it be somehow placed in the root folder and delegated/linked to the underlying modules?

Thanks,
Shane.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The log4j.properties file must appear in the classpath. If "client" and "ejb" both depend on "util", then by placing it in "util" you should be covered.
 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yea client and ejb depend on my util project as a j2ee module dependencie, so if my util project includes log4j.properties it will work. I will test myself to see.

Thanks,
Shane.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The key word here is "classpath".

Your client will have one classpath, as defined in the applet tag (assuming it's an applet).

The EJB has its own internal classpath, which has it's container classpath appended to it.

The Utility will also have its own classpath.

Expect to need a log4j properties (or log4j.xml) in each one. It may be an identical copy of the other 2 log4j files, or it may be customized for the component in question, but each classpath must include a log4j properties file, located at the root level (for example, in the WEB-INF/classes directory of a WAR).
 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks tim, that is the way i have it setup, log4j.properties in each module and running unit tests, logs are created fine in eclipse.

Websphere ND 6.1.0.17

This is more of a websphere deployment question but it still relates to the log. When i deploy my enterprise application in websphere, if i go to my WAS_ROOT\profiles... \installedApps\ProjectName.ear all i see is my jar files, how can i see the logs i create without looking inside the jars?

I know there is a properties folder at WAS_ROOT\profiles\AppSrv01 level and if i place my log4j.properties in here my log files get created at the AppSrv01 level, is there another way to view my logs at my project directory location.

Maybe it is just log4j.appender.C.File value i have to change.

Thanks,
Shane.
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic