Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Logging" Watch "EJB Logging" New topic
Author

EJB Logging

Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
How is logging achieved under EJBs? I suspect that the java.util.logging.* classes aren't going to work well in that environment. Or can I create some type of Handler tied to an entity bean or other type of database access?
I know it can be done using JMS, and I may go that route if no other option is available, but I'm looking for alternatives.
Sure this wheel has already been invented. It's wonder that they didn't consider Logging in J2EE when they added it in 1.4--unless it is a really difficult problem and no one is quite sure yet of the bets way to handle it.

--Mark
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Actually, I use Log4J and it works just fine and dandy. I think you may be yet another one of those folks who are convinced by the back part of the EJB spec that somehow you can't write to a file starting from an EJB and still be "ideologically pure"...
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
Well, that was part of it.
The other part is synchronization. I don't know much about how it's implamented. I do know a little about Java's Loggin in 1.4 which I believed is based on Log4j. What happens when I try to write to the log from different EJBs? Will I impact the server's performance, as the EJBs contend to write to the logger? Will the logger have sufficent buffering?
Anything else I should know?

--Mark
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Log4J AND the JDK 1.4 logger are already optimized for multithreaded programming. In short, don't worry about it.
Kyle
Manas Ahlaad
Ranch Hand

Joined: Nov 07, 2001
Posts: 165
Hi Mark,
log4j's beauty lies one property. messages can be written to console/files/can be avoided by just chaging an attribute in its properties file.
At coding time its set to throw messages to console ,at production to files.
observation, it is !
Manas
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
I'm reading this with much interest as I am having a devil of a time getting log4j to work in WAS 4--
I want to log both web and ejb tiers using one logger and one property file. I also want to be able to access this property file dynamically for update (via a servlet/jsp).
Can someone please set me straight re: where to
put the log4j.jar? I currently have it in the j2ee application and reference that jar in the ejbs and web layer. I have the property file in a directory added to the classpath. I see that the logger is being initialized but nothing is being written to the log (in WSAD). In WAS I am seeing what I believe are class loader errors via 'no appenders found for ' EJB components.
Should I set up log4j as its own project and include it in the enterprise application?
thanks!
Max
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: EJB Logging
 
Similar Threads
Parsing XML file using Xpath in jdk1.4
Problem reg. Delete Operation in my struts application
Which logging scheme to use with Tomcat 6
configure log4j property file using commons logging
Couldn't persist OneToMany JoinColumn/JoinTable (Unidir) using TopLink JPA