Hi,
Does anyone have any sample code to log messages to a file from an EJB event, such that the log file contains the name of the class, the warning level and warning name, and the exact error message?
As per the EJB 2.0 Spec (Public Draft), an EJB must not use the java.io package to attempt to access files and directories in a file system.
I am thinking of using the JAXP API provided by Sun to write logs to an xml file and then parse and retrieve information.
Any sample code available?
Thanks.
Ash
-
Logging Mechanism for EJBs... (101 messages)
- Posted by: Ash Parikh
- Posted on: November 21 2000 15:06 EST
Threaded Messages (101)
- Logging Mechanism for EJBs... by Greg Comeau on November 21 2000 15:26 EST
- Logging Mechanism for EJBs... by Ash Parikh on November 21 2000 16:26 EST
- Logging Mechanism for EJBs... by Greg Comeau on November 21 2000 04:50 EST
- Logging Mechanism for EJBs... by Kiran Patchigolla on November 22 2000 16:44 EST
-
Logging Mechanism for EJBs... by Ash Parikh on November 22 2000 06:54 EST
- Logging Mechanism for EJBs... by Greg Comeau on November 27 2000 02:44 EST
- Logging Mechanism for EJBs... by Adnan ERTEMEL on December 25 2000 01:40 EST
- Logging Mechanism for EJBs... by kg jawahar on July 10 2001 05:28 EDT
- Logging Mechanism for EJBs... by Frank Rizzo on September 03 2001 03:53 EDT
-
Logging Mechanism for EJBs... by Ash Parikh on November 22 2000 06:54 EST
- Logging Mechanism for EJBs... by Dag Blakstad on November 28 2000 06:38 EST
-
Logging Mechanism for EJBs... by nag sankar on November 29 2000 10:32 EST
-
Logging Mechanism for EJBs... by Henrik Schucany on December 01 2000 03:01 EST
-
Logging Mechanism for EJBs... by Trond Arve Wasskog on December 08 2000 10:53 EST
-
Logging Mechanism for EJBs... by Cuong Tran on December 08 2000 07:20 EST
-
Logging Mechanism for EJBs... by Cuong Tran on December 08 2000 07:28 EST
-
Logging Mechanism for EJBs... by Jayraj Ugarkar on July 16 2001 12:08 EDT
-
Logging Mechanism for EJBs... by Ash Parikh on August 16 2001 06:55 EDT
-
Distributed logging is bad, bad, bad! by Donnie Hale on August 20 2001 04:08 EDT
- Distributed logging is bad, bad, bad! by Ash Parikh on August 22 2001 01:44 EDT
-
Distributed logging is bad, bad, bad! by Donnie Hale on August 20 2001 04:08 EDT
-
Logging Mechanism for EJBs... by Ash Parikh on August 16 2001 06:55 EDT
-
Logging Mechanism for EJBs... by Jayraj Ugarkar on July 16 2001 12:08 EDT
-
Logging Mechanism for EJBs... by Cuong Tran on December 08 2000 07:28 EST
-
Logging Mechanism for EJBs... by Kiran Patchigolla on December 11 2000 09:35 EST
-
Logging Mechanism for EJBs... by Anjali gupta on December 12 2000 02:28 EST
-
Logging Mechanism for EJBs... by Kiran Patchigolla on December 12 2000 04:42 EST
- Logging Mechanism for EJBs... by Anjali gupta on December 13 2000 10:53 EST
-
Logging Mechanism for EJBs... by Kiran Patchigolla on December 12 2000 04:42 EST
- Logging Mechanism for EJBs... by manish garg on December 14 2000 08:19 EST
- Logging Mechanism for EJBs... by manish garg on December 14 2000 09:25 EST
- Logging Mechanism for EJBs... by Hara Totapally on February 05 2001 01:05 EST
- Logging Mechanism for EJBs... by Ramanand Singh on September 19 2001 10:25 EDT
- requirement by sm vel on June 24 2004 06:46 EDT
-
Logging Mechanism for EJBs... by Anjali gupta on December 12 2000 02:28 EST
- Logging Mechanism for EJBs... by Carey Lin on December 14 2000 05:45 EST
-
Logging Mechanism for EJBs... by Ash Parikh on December 15 2000 06:26 EST
- Logging Mechanism for EJBs... by manish garg on December 22 2000 03:41 EST
-
Logging Mechanism for EJBs... by Jon Wynett on August 24 2001 05:03 EDT
-
Logging Mechanism for EJBs... by Ash Parikh on August 31 2001 03:22 EDT
- Logging Mechanism for EJBs... by Jim Cakalic on December 12 2001 06:30 EST
- Logging Mechanism for EJBs... by Erik Pischel on September 18 2001 09:23 EDT
-
Logging Mechanism for EJBs... by Ash Parikh on August 31 2001 03:22 EDT
-
Logging Mechanism for EJBs... by Cuong Tran on December 08 2000 07:20 EST
-
Logging Mechanism for EJBs... by Trond Arve Wasskog on December 08 2000 10:53 EST
-
Logging Mechanism for EJBs... by Henrik Schucany on December 01 2000 03:01 EST
-
Logging Mechanism for EJBs... by Kiran Patchigolla on December 11 2000 09:26 EST
- Logging Mechanism for EJBs... by Bhargav Srirangam on May 18 2001 02:32 EDT
-
Logging Mechanism for EJBs... by nag sankar on November 29 2000 10:32 EST
- Logging Mechanism for EJBs... by steve holdener on January 08 2001 11:24 EST
- Logging Mechanism for EJBs... by madis Tapupere on January 10 2001 01:34 EST
- Logging Mechanism for EJBs... by Arjun Bhattacharya on January 21 2001 04:09 EST
-
Logging Mechanism for EJBs... by Jim Cakalic on February 02 2001 03:57 EST
- Logging Mechanism for EJBs... by Raj Karunakaran on September 04 2001 03:39 EDT
- Logging Mechanism for EJBs... by zhiling xu on April 13 2001 21:14 EDT
- Logging Mechanism for EJBs... by Mahesh Konala on April 24 2001 14:12 EDT
- Logging Mechanism for EJBs... by Bhargav Srirangam on May 07 2001 04:11 EDT
- Logging Mechanism for EJBs... by T J on May 17 2001 16:17 EDT
-
Logging Mechanism for EJBs... by Tony Brookes on May 17 2001 10:47 EDT
-
Logging Mechanism for EJBs... by Dennis Brennan on May 18 2001 09:46 EDT
- Logging Mechanism for EJBs... by T J on May 18 2001 11:54 EDT
-
Logging Mechanism for EJBs... by Dennis Brennan on May 18 2001 09:46 EDT
-
Logging Mechanism for EJBs... by Tony Brookes on May 17 2001 10:47 EDT
- Logging Mechanism for EJBs... by belou ga on May 30 2001 05:59 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 30 2001 09:35 EDT
-
Logging Mechanism for EJBs... by T J on May 31 2001 11:22 EDT
-
Logging Mechanism for EJBs... by belou ga on May 31 2001 05:01 EDT
-
Logging Mechanism for EJBs... by T J on June 01 2001 10:30 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on June 02 2001 09:38 EDT
-
Logging Mechanism for EJBs... by San Naik on June 14 2001 03:17 EDT
- Logging Mechanism for EJBs... by andy an on July 03 2001 03:14 EDT
-
Logging Mechanism for EJBs... by San Naik on June 14 2001 03:17 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on June 02 2001 09:38 EDT
-
Logging Mechanism for EJBs... by T J on June 01 2001 10:30 EDT
-
Logging Mechanism for EJBs... by belou ga on May 31 2001 05:01 EDT
-
Logging Mechanism for EJBs... by T J on May 31 2001 11:22 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 30 2001 09:35 EDT
- Logging Mechanism for EJBs... by David Dowat on October 22 2001 19:06 EDT
- Logging Mechanism for EJBs... by Ash Parikh on November 21 2000 16:26 EST
- Logging Mechanism for EJBs... by Rickard Oberg on November 22 2000 06:04 EST
- Logging Mechanism for EJBs... by Michael Herrick on February 16 2001 06:26 EST
- Logging Mechanism for EJBs... by Werner Keil on April 03 2001 08:13 EDT
- Logging Mechanism for EJBs... by T J on April 03 2001 05:15 EDT
- Logging Mechanism for EJBs... by Jochen Toppe on December 04 2000 14:31 EST
- Logging Mechanism for EJBs... by James Zhao on December 11 2000 09:30 EST
-
Logging Mechanism for EJBs... by Web Master on February 16 2001 07:19 EST
-
Logging Mechanism for EJBs... by guillaume compagnon on February 16 2001 12:10 EST
- Logging Mechanism for EJBs... by guillaume compagnon on February 16 2001 12:19 EST
-
Logging Mechanism for EJBs... by Jim Cakalic on March 06 2001 11:36 EST
-
Logging Mechanism for EJBs... by vaishali jain on March 16 2001 12:27 EST
-
Logging Mechanism for EJBs... by Toby Reyelts on March 16 2001 01:05 EST
- Logging Mechanism for EJBs... by Wei Jiang on March 28 2001 07:14 EST
-
Logging Mechanism for EJBs... by Brian Heisler on April 24 2001 11:23 EDT
- Logging Mechanism for EJBs... by Toby Reyelts on May 08 2001 12:50 EDT
- Logging Mechanism for EJBs... by Brian Heisler on April 24 2001 11:25 EDT
-
Logging Mechanism for EJBs... by Toby Reyelts on March 16 2001 01:05 EST
-
Logging Mechanism for EJBs... by vaishali jain on March 16 2001 12:27 EST
-
Logging Mechanism for EJBs... by guillaume compagnon on February 16 2001 12:10 EST
- Logging Mechanism for EJBs... by adam price on August 23 2001 10:49 EDT
-
Logging Mechanism for EJBs... by Web Master on February 16 2001 07:19 EST
- Logging Mechanism for EJBs... by James Zhao on December 11 2000 09:30 EST
- Logging Mechanism for EJBs... by Nate Sammons on December 18 2000 09:55 EST
- Logging Mechanism for EJBs... by Nivedita Bijlani on April 26 2001 07:28 EDT
- Logging Mechanism for EJBs... by Rajat Kumar Patro on May 24 2001 05:12 EDT
- Logging Mechanism for EJBs... by Gregory Szumowski on January 17 2001 16:08 EST
- Logging Mechanism for EJBs... by Wei Jiang on February 07 2001 22:13 EST
- Logging Mechanism for EJBs... by Stephen Davies on February 10 2001 02:09 EST
- Logging Mechanism for EJBs... by Wei Jiang on February 10 2001 07:26 EST
- Logging Mechanism for EJBs... by Stephen Davies on February 10 2001 02:09 EST
- Logging Mechanism for EJBs... by Kart Venk on February 28 2001 18:26 EST
- Logging Mechanism for EJBs... by Marcus Berglund on May 07 2001 05:28 EDT
- Logging Mechanism for EJBs... by Web Master on May 23 2001 13:46 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 24 2001 10:12 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 11:45 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 25 2001 12:40 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 03:20 EDT
-
Logging Mechanism for EJBs... by Toby Reyelts on May 25 2001 04:17 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 05:37 EDT
- Logging Mechanism for EJBs... by Dave Cowden on May 26 2001 10:23 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 05:37 EDT
- Logging Mechanism for EJBs... by Dave Cowden on May 25 2001 05:01 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 25 2001 05:10 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 05:32 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 26 2001 10:26 EDT
-
Logging Mechanism for EJBs... by T J on May 29 2001 10:46 EDT
- Logging Mechanism for EJBs... by Dave Cowden on May 29 2001 07:56 EDT
-
Logging Mechanism for EJBs... by T J on May 29 2001 10:46 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 26 2001 10:26 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 05:32 EDT
-
Logging Mechanism for EJBs... by Toby Reyelts on May 25 2001 04:17 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 03:20 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 25 2001 12:40 EDT
- Logging Mechanism for EJBs... by Dave Cowden on May 25 2001 05:06 EDT
-
Logging Mechanism for EJBs... by T J on May 25 2001 11:45 EDT
-
Logging Mechanism for EJBs... by Dave Cowden on May 24 2001 10:12 EDT
- Logging Mechanism for EJBs... by Robin Sharp on September 10 2001 05:32 EDT
- Logging Mechanism for EJBs... by Matt Redman on October 03 2001 20:51 EDT
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Greg Comeau
- Posted on: November 21 2000 15:26 EST
- in response to Ash Parikh
We use log4j (www.log4j.org) for application logging without any problem -- despite the EJB specification. That section of the spec describes limitations which are supposed to ensure that your EJB is portable. As long as you take precautions like use file.separator and don't make any platform-specific assumptions about your file system you should be fine. You may have to update the security policy of your EJB container to allow the use of java.io. We use Weblogic and this works fine.
You should *not* use the file system for persistence of business entities. If you do then the container will not be able to control your persistence operations within the scope of a transaction.
Such a sweeping limitation (no use of java.io, period) is going a little overboard, in my opinion. Using JDBC for an application log is a little absurd for most production environments.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Ash Parikh
- Posted on: November 21 2000 16:26 EST
- in response to Greg Comeau
Hi,
I have tested the "log4j" application and it seems like it is a bit too complex for simple purposes of basic logging. I noticed that it uses an heirarchial Category model and then the Appender class by which one can specify what type of format the log should be written in.
Is there a way to get all the functionality provided by "log4j" otherwise? How have you used "log4j"? Have you made some modifications?
Thanks.
A -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Greg Comeau
- Posted on: November 21 2000 16:50 EST
- in response to Ash Parikh
Your requirements for "Basic logging" will not remain basic for very long. Simply wrap a facade class around log4j to expose a simpler interface to your application. You can always expose more functionality if your app needs it.
Regarding categories, we just use the fully qualified class name of the instance which writes to the log. We have a facade pattern that uses a singleton Log instance internally. The facade exposes a number of static methods to write out various types of log messages: debug, info, warn, error, emerg. The methods are overloaded to take an optional Throwable instance as an argument in addition to a simple String message.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Kiran Patchigolla
- Posted on: November 22 2000 16:44 EST
- in response to Greg Comeau
I understand that using JDBC for this purpose might not make sense in most cases but I am not so sure if we could ignore the EJB spec about not using IO in EJB app's...
What I am not sure is if you are logging messages into physical files how would the container handle the situation if it distributed the bean's instances accross multiple JVMs?
Probably I am missing something or I am wrong but I would really appreciate your input on this..
Thanks,
Kiran -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Ash Parikh
- Posted on: November 22 2000 18:54 EST
- in response to Kiran Patchigolla
Presently I am writing the logs to an XML file using the JAXP API provided by Sun. An EJB or a set of EJBs will be the callers for this logging mechanism, which will then write to the XML-based log file. The logging mechanism will be re-written as an EJB itself.
Hope this answers your question.
Ash -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Greg Comeau
- Posted on: November 27 2000 14:44 EST
- in response to Ash Parikh
Presently I am writing the logs to an XML file <
What resource is used to persist your XML document? File system? Database? Something else?
We use XML for data interchange but an XML document can be stored in any number of ways. Using XML doesn't directly address the issue of using java.io within EJBs.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Adnan ERTEMEL
- Posted on: December 25 2000 01:40 EST
- in response to Ash Parikh
Hi,
What is the point in writing messages to an XML file instead of writing directly to an ordinary file?
Adnan -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: kg jawahar
- Posted on: July 10 2001 05:28 EDT
- in response to Ash Parikh
Haii Ash,
U r concept is correct. I have the same concept. All the best.
Mail me : kgjawahar@yahoo.com -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Frank Rizzo
- Posted on: September 03 2001 15:53 EDT
- in response to Ash Parikh
Ashish,
I am working on a similar project, writing to an XML-based log file. The log entries consist of individual nodes, which need to be placed in a specific part of the tree. Using DOM, I reference the log file as a Document, check to see if the needed elements exist, and append the log entry as a child node in the correct part of the tree. I then serialize the Document back to file.
The issue I am trying to solve now involves performance. Some of the log files can become extremely large. If I have to serialize the Document every time I add a log entry, and the file is 50 MB ... well, you know how bad that would hurt performance on the server.
I've done a lot of research, but haven't found a way to insert the node in the correct place without fully serializing the entire file. Any suggestions?
Thanks.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dag Blakstad
- Posted on: November 28 2000 06:38 EST
- in response to Greg Comeau
<p>
It is possible to use log4j without having to access the filesystem directly from the VM the app. server is running in.<br>
By using the org.log4j.net.SocketServer & SocketAppender you can send your logging requests over the network.
</p>
<p>
I have not tried to do this myself yet, but I have to do this soon. Anyone who have tried this?
</p>
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: nag sankar
- Posted on: November 29 2000 22:32 EST
- in response to Dag Blakstad
Check out JLog Toolkit from IBM Alphaworks
http://alphaworks.ibm.com [search for JLog]
It enables you to write logs thro a TCP socket stream..
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Henrik Schucany
- Posted on: December 01 2000 03:01 EST
- in response to nag sankar
I have made a Logging tool which can log in a File (allways open or closed on every logging), TCP, UDP or to an URL.
The tool is logging activity in an EJBServer with lots of EntityBeans and SessionBeans. It logs time, threadId, Class.method, Userdefined info, userId and optional stackTrace.
With full trace on it eats almost 35-50% of the performance, which isn't abnormal, but notice that the fastes way of logging is to write to an open file.
The next "slowest" is to close the File on every logEvent. On third place comes TCP and the slowest is UDP!
So my advice is to write to an open File (XML or what ever format needed).
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Trond Arve Wasskog
- Posted on: December 08 2000 10:53 EST
- in response to Henrik Schucany
JMS is an the perfect answer to logging, providing asynchronous messaging capabilities. Just send your log message on a queue and that's it. On the other end of the queue you can have low priority listeners handling the log messages. These listeners can write to any destination (database, file, screen etc) in any format (XML, plain text, CSV etc) you like. Using MessageDrivenBeans (EJB2.0) as queue listeners really makes this architecture elegant. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Cuong Tran
- Posted on: December 08 2000 19:20 EST
- in response to Trond Arve Wasskog
Great idea! Is there any limitation in doing this?(concerning the ejb spec) -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Cuong Tran
- Posted on: December 08 2000 19:28 EST
- in response to Cuong Tran
Never mind the above question. There is a whole thread
discussing this same issue :) -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Jayraj Ugarkar
- Posted on: July 16 2001 12:08 EDT
- in response to Cuong Tran
I am looking for the discussion thread which discusses about JMS and logging. If anybody has a link to that please reply to this message. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Ash Parikh
- Posted on: August 16 2001 18:55 EDT
- in response to Jayraj Ugarkar
Hi all,
When I started this thread, the concept of Message Driven Beans was not completely clear in the industry. It seems like a likely solution that if I use Message Driven Beans as a logging mechanism, not only will I be able to send messages to the EJB, but also have the EJB send out messages, and thus log the output from the EJB. This is the fine-grained control that I was looking for. But there is also the asynchronousity of the concept that one needs to remember, especially if you are using this paradigm for logging level 1 (extremely serious) logs, and they arrive asynchronously into the log.
Ash -
Distributed logging is bad, bad, bad![ Go to top ]
- Posted by: Donnie Hale
- Posted on: August 20 2001 16:08 EDT
- in response to Ash Parikh
I know the concept of distributed logging and/or a central "logging service" is all the rage these days. But I've experienced such a system in production, and all I can tell you is that it's not a good idea.
First and foremost, when logging at high levels from lots of services and/or lots of hosts, you'll just kill your network bandwidth. This is based on real, personal, first-hand experience where 70+% of our bandwidth was being consumed by logging activity.
Second, it's difficult enough trying to wade through the log entries for a single process in its own file / source, let along if multiple processes go to the same file / source.
IMHO, the correct solution is in-process logging (a la log4j - a godsend) to a file for that particular process. For collation, etc., post-process these files with tools/scripts. Interestingly, that's pretty much the way logging works for most of the web server world.
FWIW...
Donnie -
Distributed logging is bad, bad, bad![ Go to top ]
- Posted by: Ash Parikh
- Posted on: August 22 2001 13:44 EDT
- in response to Donnie Hale
Hi,
I agree with you that an in-process logging mechanism is the way to go, which is why I proposed that sending the log messages to an XML file would be ideal.
J2EE gives the developer the flexibility and the range of technologies to glue together a scalable solution for mechanisms such as caching, logging etc., By this I mean that we can easily take advantage of technologies such as JMS, Message-driven EJBs, Java Cryptography Edition, serialization and the up-and-coming Java XML APIs such as JAXM, JAXR, JAXP and JAX-RPC. It is encouraging to see how tightly all these concepts come together when you use a single paradigm such as J2EE.
Performace v/s convenience and RAD is always something to consider...
Ash -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Kiran Patchigolla
- Posted on: December 11 2000 21:35 EST
- in response to Trond Arve Wasskog
Very true....
Finally, I implemented JMS logging facility for our app and seems to be working great....We did not need any configuration properties, did not need to access the file system, do have asynchronous messaging, could easily support logging for multiple clients on the same app server instance...Most of all it does not violate the spec without loosing any capabilities..since this seems to be the main concern with any logging facility in EJB apps....
Thanks to all...
Kiran.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Anjali gupta
- Posted on: December 12 2000 14:28 EST
- in response to Kiran Patchigolla
Hi!!
I am new to EJB, but i really liked the JMS logging
functionality. Can anyone point me to some code
that I can look at to do the same.
Thanks
Anjali Gupta -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Kiran Patchigolla
- Posted on: December 12 2000 16:42 EST
- in response to Anjali gupta
jLog has this logging capacity, you should be able to get their source code....
http://www.javalogging.com/ -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Anjali gupta
- Posted on: December 13 2000 10:53 EST
- in response to Kiran Patchigolla
Thanks Kiran!! -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: manish garg
- Posted on: December 14 2000 20:19 EST
- in response to Kiran Patchigolla
Hi Kiran,
I read your message and downloaded Jlog from the site. But it seems there are quite a few classes to take care of. If I wish to use JMS to log messages, could you give me a starter please.
thanks, -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: manish garg
- Posted on: December 14 2000 21:25 EST
- in response to Kiran Patchigolla
Hi Kiran,
I read your message and downloaded Jlog from the site. But it seems there are quite a few classes to take care of. If I wish to use JMS to log messages, could you give me a starter please.
thanks, -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Hara Totapally
- Posted on: February 05 2001 13:05 EST
- in response to Kiran Patchigolla
Hi Kiran,
Can you please provide me with some starter information using JMS for logging?
Thanks
Hara -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Ramanand Singh
- Posted on: September 19 2001 10:25 EDT
- in response to Kiran Patchigolla
Kiran,
Would you like to share your implementation detail using JMS for logging?
Regards,
-ramanand -
requirement[ Go to top ]
- Posted by: sm vel
- Posted on: June 24 2004 06:46 EDT
- in response to Kiran Patchigolla
we like to have JMS APPENDER properties so please send the jms properties to my mail id ch_ramgopal at yahoo dot co.in -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Carey Lin
- Posted on: December 14 2000 17:45 EST
- in response to Trond Arve Wasskog
I'm using the same architecture for logging. Since I'm new to EJB. What should I do to enforce concurrent logging when the EJB has more than one instance? Should I made the destination to be a static variable or a singleton object? Or other way? I'm really interested in What your logging work in the server site.
I really appreciate your help.
Carey -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Ash Parikh
- Posted on: December 15 2000 18:26 EST
- in response to Trond Arve Wasskog
Hi,
I did research using JNS for logging, but as far as I understood the concept, there is no way to make sure that the log has been written. All that happens is that a log is submitted to a queue. After this, it is not certain when it will be serviced. Correct?
Thanks.
A -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: manish garg
- Posted on: December 22 2000 15:41 EST
- in response to Ash Parikh
look at persistent JMS. It ensures that the message is written at least once to the file of db being used.
manish. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Jon Wynett
- Posted on: August 24 2001 17:03 EDT
- in response to Trond Arve Wasskog
I've been using my own JMS logging tool in WebLogic for quite a while and it works well except for the following problems.
1. JMS when called from an EJB picks up the current transaction from the EJB. If the ejb encounters an error and rolls back, so do all the log msgs. My workaround for this is to suspend and resume the trx around the call to the jms session.
2. I find publishing a JMS msg to be really slow. It is the single slowest thing the logger does. The "publish" call is not asynchronous so it slows down the processing of the whole system. Writing directly to a file is about 3x faster although it is not asynchronous.
Any thoughts on these issues and possible solutions?
Thanks, Jon Wynett -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Ash Parikh
- Posted on: August 31 2001 15:22 EDT
- in response to Jon Wynett
Atlast there is access to the logging API's from Sun/JavaSoft themselves. This should be a shot in the arm while developing applications that need simple or complex logging functionality.
http://java.sun.com/j2se/1.4/docs/guide/util/logging/overview.html
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Jim Cakalic
- Posted on: December 12 2001 18:30 EST
- in response to Ash Parikh
In response to the Sun logging APIs being a "shot in the arm", that can only be asserted in the context of anyone currently able to use JDK 1.4.
The Java Logging API (aka JSR47) requires JDK 1.4. Efforts to backport JSR47 to earlier JDKs are doomed to fail because the java.util.logging package is located under the java namespace. This will cause backported code to systematically throw a SecurityException under JDK 1.3.
Secondarily, if you are developing in anything other than a "stand-alone" application environment, how long will it be before your container vendor gets around to integrating JDK 1.4? By way of measurement, how long did it take many container vendors to migrate from JDK 1.1.x to JDK 1.2? And then to 1.3? In many cases, it will be months after the GA release of JDK 1.4 by Sun before J2EE developers will see the benefit.
As for any remaining differences between log4j and the JSR47 implementation, I recommend you consult http://jakarta.apache.org/log4j/docs/critique2.html.
Best regards,
Jim Cakalic -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Erik Pischel
- Posted on: September 18 2001 09:23 EDT
- in response to Jon Wynett
[JMS logging: JMS when called from an EJB picks up the current transaction from the EJB.]
how about wrapping that call into a method (e.g. a singleton)? Would that work?
["publish" is about 3x slower than writing to a file]
Would it be ok to use an asynchronous producer/consumer queue (see http://www.javaworld.com/javaworld/jw-05-1999/jw-05-toolbox.html)? It uses an extra thread to consume the message and "publishes" it. I'm aware that extra threads are a no-no in EJB context, but I recently had a EJB training and the instructor told me he'd think it would be ok if I started the consumer thread at startup time of the server. Any idea if this is true? -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Kiran Patchigolla
- Posted on: December 11 2000 21:26 EST
- in response to Dag Blakstad
Using SocketAppender in log4j might work and probably in future they might come up with JMSAppender and stuff but as I see you got be careful because you would be accessing the filesystem to configure log4j. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Bhargav Srirangam
- Posted on: May 18 2001 14:32 EDT
- in response to Kiran Patchigolla
Hi Kiran,
could you give me a pointer to any existing examples using the SocketAppender for servlets/ejb logging, or provide me with some example code to be able to log messages using SocketAppender.
Could you relay ur message to Bhargav at consultant dot com
thanks again for ur time Kiran
regards
Bhargav
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: steve holdener
- Posted on: January 08 2001 11:24 EST
- in response to Greg Comeau
I think the limitation is that the *EJB* should not use java.io. That makes perfect sense to me. Instead, you could have a class like "Logger" or whatever you want to call it. Use static methods or make it a singleton and do all logging like this:
Logger.write(classname, severity, text);
XML would be a great idea for the log file. I'd never even thought of that. You can parse for severity, easily convert to HTML for browsing, etc.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: madis Tapupere
- Posted on: January 10 2001 13:34 EST
- in response to steve holdener
The problem with XML as a log file is that it is much more complicated to do even simple searches on ad hoc basis.
With simple flat files you could use grep type of stuff etc. on even huge files to filter out necessary lines and get some preliminary results fast. With XML you need a parser and an approach for ad hoc queries (XQL or something).
Haven't found a good tool yet besides importing into database and running queries there. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Arjun Bhattacharya
- Posted on: January 21 2001 16:09 EST
- in response to steve holdener
I have done a simmilar thing (Logger Class) for a project last month. The best thing about this is that ramp up time to using this against using JLog et al. is much less. Best of all it works:))
I saw in an earlier thread somebody mentoining using JLog with WAS 3.5 (specifically EJB). FYI JLog uses threads. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Jim Cakalic
- Posted on: February 02 2001 15:57 EST
- in response to steve holdener
The log4j package, mentioned previously, also permits logging to a Socket. It includes a SocketAppender, a SyslogAppender (which writes using Sockets to a Syslog daemon), a JMSAppender, an SMTPAppender, and a recent contribution of a JDBCAppender. Incidentally, the package has now been adopted by the jakarta project of Apache.org.
Being involved in J2EE, I always have to look a bit askance at the oft-repeated "restriction" on use of java.io APIs by J2EE applications. The EJB spec says:
"An enterprise bean must not use the java.io package to attempt to access files and directories in the file system. The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC, to store data."
What is the real point of this restriction? It is that file systems are not typically transactional in nature. If your transaction is to have ACID properties, then resource managers that can be coordinated for commit or rollback by the container should govern all the resources utilized by your transaction. Since files cannot do this, they should not be used for storage of information that is critical to the success or failure of a business process. Consider too that securing files can be problematic. Files limit the portability of an application because they introduce potential encoding concerns, hardcoded path problems, etc. And file systems are not considered highly available network accessible resources that can be located by using JNDI.
But that doesn't mean there might not be valid uses of files for other purposes. What about property files? What about resource bundles? What about XML documents? Where do you put images? How do you think the container does it's logging?
On the project that I am currently leading (WebSphere 3.5.2), we use files for read-only resources (non-transactional) as well as for logging. It isn't that files are somehow _evil_. It is that unrestricted use of files can lead to the problems I've enumerated. Unless your container absolutely prevents the use of the java.io APIs, I wouldn't so readily dismiss using files for logging. Writing a log to a local file has been, in my experience, much more performant than either JMS or JDBC solutions and doesn't require nearly the infrastructure of these and other (SMTP and Socket server) options. When it comes to logging, you want it to be pretty darn simple because it is going to be most valuable to you when everything else is going wrong.
Best regards,
Jim Cakalic -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Raj Karunakaran
- Posted on: September 04 2001 15:39 EDT
- in response to Jim Cakalic
We are moving from a net-centric environment to a EJB-based
environment. In the net-centric world all the logging was done within the JVM for a particular client (normal file i/o). Now in a distributed environment where the EJB's are on different servers than the client (in fact it could be on any server since the container could move EJB's around to perform load-balancing or on a fail-over), how would you ensure that the log information is generated on the client side rather than on the server?
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: zhiling xu
- Posted on: April 13 2001 21:14 EDT
- in response to Greg Comeau
Could you please tell me how to update the security policy of Weblogic 6.0
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Mahesh Konala
- Posted on: April 24 2001 14:12 EDT
- in response to Greg Comeau
I have been trying to use Log4j with IBM websphere for a webbased application.My first problem is it doesn't recognize the Properties file for Log4j
. My second problem(to overcome the first i had to hardcode the Path for properties file..) is after it restarts the server everytime it encounters PropertyConfigurator class(its a log4j class..) can anybody tell me whats happening??? -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Bhargav Srirangam
- Posted on: May 07 2001 16:11 EDT
- in response to Mahesh Konala
Hi Mahesh,
can you suggest me a starter for log4j, i am trying to run the examples provided with the package and i am able to run the examples, but need to explore further into this logging package.
i would greatly appreciate if you can provide me with some info.
My email is Bhargav at consultant dot com, once again ur help will be greatly appreciated
thanks for your time
Bhargav -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 17 2001 16:17 EDT
- in response to Greg Comeau
But what happens when a logging message pops up that you didn't write, for example, where a nullpointerexception is thrown; that gets written to the weblogic log file; how would you get those to go to some other special log file or to a JMS queue?? The JMS queue sounds like a great idea, but I wonder how you would get exceptions to go to it. cya -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Tony Brookes
- Posted on: May 17 2001 22:47 EDT
- in response to T J
Getting your exceptions to go the JMS queue means catching the right exceptions in the right places.
Of course, you may very well not want to catch RuntimeException and its children, precisely because you don't know what to do with them in any case!
We have been using LOG4J with WebLogic with great success, although we have the same problem, that the exceptions we deliberately don't catch end up in the weblogic.log file.
I don't know if WebLogic allows you to install your own Exception handler. You can over-ride default behavior of a ThreadGroup by sub-classing it and over-riding the uncaughtException(Thread, Throwable) method. If there is any way in WebLogic to override the default thread group (or plug in your own exception handler to whatever ThreadGroup sub-class they may have written) then you are sorted. You can simply put the call to your JMS logger in there.
Of course, the default handler will simply dump the stack trace to System.out. To do anything more _might_ be unpredictable. For instance, if the Throwable in question is an OutOfMemoryError then do you have sufficient resources to send a message to JMS?
Chz
Tony -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dennis Brennan
- Posted on: May 18 2001 09:46 EDT
- in response to Tony Brookes
What is the advantage of using Log4J instead of the facilities provided in weblogic? It seems like wls6.0 is robust enough to handle most logging needs. I'm trying to decide whether to include Log4J or just wrap the logging in wls. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 18 2001 11:54 EDT
- in response to Dennis Brennan
Well, if I can't get "all" of the logging to go to one place, I wouldn't want to use something like log4j or a jms queue (as cool as that sounds; what a neat idea!), because it would make it harder to decipher problems, and you'd have to bounce back and forth.
No, I think I'll continue using the weblogic log file. cya -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: belou ga
- Posted on: May 30 2001 05:59 EDT
- in response to Greg Comeau
Hello,
I'm pretty new to ejb and unsuccessfully tried to implement the log4j API for logging messages.
I think i miss something about the proper way to initialize the Categories.
Could anyone send me some example of login with log4j in an entity bean?
Artediane at isuisse dot com
Thank you
Regards -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 30 2001 21:35 EDT
- in response to belou ga
This ought to get you started:
to create a category:
...
private static Category _cat = Category.getInstance(TestSQLOrderFetch.class.getName());
...
initialize log4j:
BasicConfigurator.configure();
log some stuff!!
_cat.error ( "This is an error" );
_cat.debug ( "This is a debug" );
See log4j docs for more samples....
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 31 2001 11:22 EDT
- in response to Dave Cowden
Why are you making that static? If you're using it in an EJB, isn't that discouraged? -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: belou ga
- Posted on: May 31 2001 17:01 EDT
- in response to T J
I agree.
My question is:
Is it correct to declare the Category static final? (which is allowed in an EJB AFASK ).
Where is the right place to set the configurator. Is the singleton pattern a solution ( a sort of configurator class which is a singleton?)
In this case, including the fact that there might be n AS instances,does this singleton should lived in jndi in order to be sure that only one instance lives in the whole network?
Sorry
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: June 01 2001 10:30 EDT
- in response to belou ga
Is it correct to declare the Category static final? (which is allowed in an EJB AFASK ).
That's my understanding...
>>Where is the right place to set the configurator. Is the singleton pattern a solution ( a sort of configurator class which is a singleton?)
That's what I did for our logging... cya
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: June 02 2001 21:38 EDT
- in response to T J
Oops. I'm sorry-- I posted some log4j code that didnt make a lot of sense-- I forgot we were talking about EJBs, and just posted some plain 'ol log4j code.
For our logging for log4j inside of WLS, we used a line like this:
PropertyConfigurator.configure(..)
inside of a Weblogic Startup class. that way, the log4j to weblogic "bridge" is started up before anybody can access the server ( we mark this startup class such that if it fails, server startup is aborted).
Inside of the EJBs we use to the code as it was posted. The static final category may not be the recommended approach, but it works well and is very fast.... -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: San Naik
- Posted on: June 14 2001 03:17 EDT
- in response to Dave Cowden
hi Dave,
ur code gives error on line::::::::
_wlogger = new NonCatalogLogger(source );
it is not getting class NonCatalogLogger
What do I need to do? -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: andy an
- Posted on: July 03 2001 03:14 EDT
- in response to San Naik
Is there some performance decline by doing lookup on every appending message to queue?
Does log4j support JMS well? -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: David Dowat
- Posted on: October 22 2001 19:06 EDT
- in response to Greg Comeau
Greg,
You seem to have acquired some savvy with log4j and EJB's,
could you possibly give me some advice?
I am currently creating a logging API for a 3 tier architecture. The requirements are the following:
1) Central logging for all parts of the system.
2) All messages contain an application context identifier
for the purpose of grouping the log messages.(Application
context is just an identifier issued for each request from the browser by the webserver. This would then be
passed in the parameters through each layer. Then all
messages could be grouped by this ID and timestamp in order to construct the execution sequence.)
3) Static methods for all login activity.
We are using log4j and WLS6.0 and will want to migrate to
WebSphere. I've been building an API to test what is possible and have found some success but I am unsure if I
am on shaky ground with regards to the appservers.
In order to share the current context between the webserver and appserver I added the context to the method call parameters. In order to minimize the passing of the application context id within the classes that perform the work in our EJB's, I have been setting a ThreadLocal variable with the context. On the webserver side, I am fairly sure that a given request will be satisfied within a single thread of execution. But I have found that within WLS6.0 that all subsequent calls from the initial EJB execute within the same thread. But I fear that this behavior is strictly a function of our current app server configuration and will not be the case with other app servers or when we set up clutering.
Do you know how the appserver thread model works? Is it just a plain bad idea to rely on all calls for an initial re -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Rickard Oberg
- Posted on: November 22 2000 06:04 EST
- in response to Ash Parikh
If you use the JBoss server all you have to do is call System.out or System.err and the message will be logged in the server logs with extra information (such as bean name, timestamp, type).
You can add custom filters that extract bean logs into separate log files.
If you want you can also use our proprietary log API for more control over the logging.
For more info on JBoss see www.jboss.org
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Michael Herrick
- Posted on: February 16 2001 06:26 EST
- in response to Rickard Oberg
sys.outs kill performance ... -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Werner Keil
- Posted on: April 03 2001 08:13 EDT
- in response to Rickard Oberg
JBoss 2.1 (maybe already in 2.0) also contains Log4J in its extensions. So those who are familiar with it or do not fear to learn it (despite the more complex structure) may also use Log4J inside JBoss. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: April 03 2001 17:15 EDT
- in response to Werner Keil
I wrote a singleton class to do it with debugging levels and it derives the calling method from a stack trace... -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Jochen Toppe
- Posted on: December 04 2000 14:31 EST
- in response to Ash Parikh
Another way would be to have a separate central service which listens on the corba orb (or rmi or whatever).
It can receive messages from your beans and write them to a central file. This seems to be at least a standard way to do this, I think Inprise even has some sample code for this somewhere..
greetings,
jochen
jochent@poet.de -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: James Zhao
- Posted on: December 11 2000 09:30 EST
- in response to Jochen Toppe
I am interested to know how the an EJB can talk to
an Orb service. Could you give me some hint?
Please also relay your reply to my email
james-zhao at excite dot com
Thanks!
James -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Web Master
- Posted on: February 16 2001 07:19 EST
- in response to James Zhao
well...this all depends how ur appserver implements iiop.
By and large they use extension mechanism of the JVM.
just start the orb service at background , change the properties file.....and replace the jars with ur ORB jars .
btw which appserver r u using ?
.net -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: guillaume compagnon
- Posted on: February 16 2001 12:10 EST
- in response to Web Master
sure! Log4J is too complex for logging "administration messages"
I hope that JSR "Java Logging API" would be adopted very quickly and that J2EE products would support that. (The only problem with threads is that AS doesn't want "foreign" threads that are not managed by its )
Imagine an AS integrating this API , and no more fears...
Althought, I am not sure that XML in logging messages are very usefull... I know, I know, XML is a BuzzWord ! -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: guillaume compagnon
- Posted on: February 16 2001 12:19 EST
- in response to guillaume compagnon
For a prototype, I ve used JMX API for logging. but It is not very good. the JMX implementation (adventnet) uses threads ...
and J2EE Management API is still in JSR! -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Jim Cakalic
- Posted on: March 06 2001 11:36 EST
- in response to guillaume compagnon
If you think log4j is "too complex", you're aren't going to be pleased with the results of the JSR-0047 implementation. That specification details a design that shares many of the same principles as log4j. Unfortunately, they maintain the notion of a Singleton logger which log4j has eliminated. And I don't recall it being as flexible with respect to external specification of log event format. But it is by no means as simple as System.out.println -- nor should it be.
Jim Cakalic -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: vaishali jain
- Posted on: March 16 2001 12:27 EST
- in response to Jim Cakalic
The project I am working for has EJBs that call native methods. I know it is against EJB specs and we are trying to find an alternative. But till that happens, which may not be too soon, I need to do logging on both the ejb end and at the native end. Do you or anyone has any suggestions as to how this can be accomplished?
My concerns are ...
How can I achieve synchronized logging between native code and java code?
Can JMS help in this case?
Can tools like Log4j be useful at all or should I resort back to simple singleton logger class approach? But then also can I use it with multiple beans and their multiple instances and the native code?
Any help is appreciated.
Thanks -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Toby Reyelts
- Posted on: March 16 2001 13:05 EST
- in response to vaishali jain
vaishali jain wrote:
The project I am working for has EJBs that call native methods. I know it is against EJB specs and we are trying to find an alternative. But till that happens, which may not be too soon, I need to do logging on both the ejb end and at the native end. Do you or anyone has any suggestions as to how this can be accomplished?
My concerns are ...
How can I achieve synchronized logging between native code and java code?
Can JMS help in this case?
Can tools like Log4j be useful at all or should I resort back to simple singleton logger class approach? But then also can I use it with multiple beans and their multiple instances and the native code?
-------
My reply:
Generally speaking, if you need to access native code from an EJB, you don't <smile>. Instead, you create some other 'remote' interface for the invocation of that native code as a service. So, for example, you could create an RMI server that would invoke that native code, then call that RMI server from your EJB. If the native code is one way, (i.e. you don't require a synchronous response), then you can do things like send a JMS message.
God bless,
-Toby Reyelts
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Wei Jiang
- Posted on: March 28 2001 07:14 EST
- in response to Toby Reyelts
SuperLogging from Super is a centralized logging. You
can log from native code. It is very simple, just
call a SQL satement.
Of course, you will not get all the features that are
available for Java.
I can provide detailed informtion about native code
access if you want.
Try SuperLogging of Super from www.acelet.com.
The next release will be free for open source (Jonas, jboss and
j2ee-ri).
SuperLogging is a full-featured logging tool:
* It is a centralized logging, guaranteed tobe chronolotical.
It supports distributed computing and works well in any
clustering environment. all log messages are recorded in
one central place regardless which EJB runs on which
server.
* It is platform neutral and EJB vendor neutral.
* All log statements used in the source code do not need be
removed for production releases. Log messages can be
dynamically filter out and the performance penalty will be
minimum.
* An open source wrapper com.acelet.opensource.logging.Alog is
provided for preventing vendor lock in. Source code of EJBs
is not required for any modification if another logging
packages is chosen. In that case, the only modification
needed is this wrapper, which is just a few lines of code.
* It is fully dynamically configurable by a Swing tool. The
configurable attributes include the following:
* Choice of configuration scope: Global Dynamic, Global Static
and Singleton.
* Choice of mode: Quiet, Verbose and Conditional.
* Class registration: log messages will be printed out for
registered classes only.
* Log level: lower level log requests will be filtered out.
* It provides Tracing facilities which show both log messages
and source code with marked line in question.
* It provides built-in email alert method and alert interval
control.
* It provides email methods which allow sending email by a
simple method call.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Brian Heisler
- Posted on: April 24 2001 11:23 EDT
- in response to Toby Reyelts
Could you not write an application that connects to the EJB via sockets, then connects to the native code using named pipes and JNI? WOuld this work? I am new to EJB's and just a little less new to JAva.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Toby Reyelts
- Posted on: May 08 2001 12:50 EDT
- in response to Brian Heisler
Brian Heisler wrote:
Could you not write an application that connects to the EJB via sockets, then connects to the native code using named pipes and JNI? WOuld this work? I am new to EJB's and just a little less new to JAva.
------
My response:
As long as it was the EJB opening the socket connection and the native code was the one accepting it. (This is essentially what I was saying in my previous message). EJBs are not allowed to run 'socket servers'.
God bless,
-Toby Reyelts -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Brian Heisler
- Posted on: April 24 2001 11:25 EDT
- in response to vaishali jain
Could you not write an application that connects to the EJB via sockets, then connects to the native code using named pipes and JNI? WOuld this work? I am new to EJB's and just a little less new to JAva.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: adam price
- Posted on: August 23 2001 10:49 EDT
- in response to James Zhao
You can connect to an ORB with Borland Application Server this allows the EJB to be a java object and a corba object at the same time.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Nate Sammons
- Posted on: December 18 2000 09:55 EST
- in response to Ash Parikh
Take a look at this:
http://protomatter.sourceforge.net/1.1.2/index.html
The package "com.protomatter.syslog" contains a robust logging system suitable for use with EJBs. I'm biased towards it because I'm the author ;-) Read the whitepaper referenced in that document for an introduction to use. Version 1.1.3 will be out in the next couple of weeks, and has JMS integration, remote logging (via RMI or other protocols), a logger that sends email, and lots of performance improvements.
If you want to peek at the next release, there's a beta available from http://www.protomatter.com/software/beta
-nate
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Nivedita Bijlani
- Posted on: April 26 2001 07:28 EDT
- in response to Nate Sammons
Hi,
I'm working on this project where we are using a cocoon framework. We have four applications, hence four producers that interact with EJBs (that reside on an Inprise app. server, a different JVM). I have a question:
how can I pass the config file for Syslog (config.xml) for cocoon ? Do I pass it in, in the init() method of each producer individually or is there any better way ?
Also, could you suggest a neat way of configuring syslog on the EJB side?
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Rajat Kumar Patro
- Posted on: May 24 2001 05:12 EDT
- in response to Nate Sammons
G'Day Nate,
I'm a Java Developer currently working with JBuilder and Borland App server environment.We're developing a small proof of concept project work.In my project i want to implement this Syslog mechanism in both client side as well as server side programming.I tried to implement the package by giving the two jar files(protomatter.jar and jdom.jar)into the project classpath settings.Then i tried to use the logging codes in my programme during execution its working fine, but its not generating any log file in my local m/c.
Can u help me in this regard, and send me some code sample so that i can evaluate ur product in a better way.
Thanks in advance
Cheers
rajat.
E-mail:rajat_k_patro at yahoo dot com
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Gregory Szumowski
- Posted on: January 17 2001 16:08 EST
- in response to Ash Parikh
Try looking at "Super" which you can download for free from the http://www.acelet.com website. It not only provides you with logging capability but also the ability to do a peek or poke of the variables to help you in the debugging process. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Wei Jiang
- Posted on: February 07 2001 22:13 EST
- in response to Ash Parikh
Try SuperLogging of Super from www.acelet.com
Try SuperLogging of Super from www.acelet.com.
SuperLogging is a full-featured logging tool:
* It supports distributed computing and works well in any
clustering environment. It is guaranteed that all log
messages are recorded in one place and in the order of
actual happening, regardless which EJB runs on which server.
* It is platform neutral and EJB vendor neutral.
* All log statements used in the source code do not need be
removed for production releases. Log messages can be
dynamically filter out and the performance penalty will be
minimum.
* An open source wrapper com.acelet.opensource.logging.Alog is
provided for preventing vendor lock in. Source code of EJBs
is not required for any modification if another logging
packages is chosen. In that case, the only modification
needed is this wrapper, which is just a few lines of code.
* It is fully dynamically configurable by a Swing tool. The
configurable attributes include the following:
* Choice of configuration scope: Global Dynamic, Global Static
and Singleton.
* Choice of mode: Quiet, Verbose and Conditional.
* Class registration: log messages will be printed out for
registered classes only.
* Log level: lower level log requests will be filtered out.
* It provides Tracing facilities which show both log messages
and source code with marked line in question.
* It provides built-in email alert method and alert interval
control.
* It provides email methods which allow sending email by a
simple method call.
By the way, there are other SuperComponents on Super:
PeekPoke and SuperStress. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Stephen Davies
- Posted on: February 10 2001 02:09 EST
- in response to Wei Jiang
You might want to check out JSR000047. This details logging APIs currently under review. "The Java Logging APIs will be delivered as part of J2SE 1.4 "Merlin". Beta will be around March 2001 and FCS will be around October." -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Wei Jiang
- Posted on: February 10 2001 07:26 EST
- in response to Stephen Davies
Yes, it is for J2SE, not J2EE. It is a standard
API. You still need a logging engine in J2ee server. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Kart Venk
- Posted on: February 28 2001 18:26 EST
- in response to Ash Parikh
I just wrote a simple wrapper around Weblogic's logging facility that does the trick for me (for now !).
Weblogic 6.0 logging works for both I18N and L10N messages, and can integrate with JMS as well.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Marcus Berglund
- Posted on: May 07 2001 05:28 EDT
- in response to Kart Venk
I'm trying to find a way of doing this (reading syslogs from the appserver aswell) on IBM Websphere Enterprise Edition. - Trouble is that the logfiles (error.log / activity log) are not textfiles - WSEE uses some binary file format for logging. This format can then be parsed using the showlog utility. This sucks, as there is no way to get a continuous feed of log messages. Has anyone had experience of gettig some logtool to continually parse the binary logfiles - or does anyone know of another way around it?
/m -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Web Master
- Posted on: May 23 2001 13:46 EDT
- in response to Kart Venk
Does anyone have a simple wrapper to WebLogic's logging framework?
Yvon Lavoie -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 24 2001 22:12 EDT
- in response to Web Master
We have used Log4J for all of our logging, with tremendous success.
We also use Weblogic 6.0 for our application server, and found that we wanted much of our code to be portable and testable without any weblogic specific code in it.
To take advantage of the benefits of the weblogic framework, and to allow our code to work outside weblogic when we run our unit tests, we wrote a Log4J Appender that maps events from log4j to the weblogic event log. We write all of our classes ( yes, including EJBs) to the Log4J API, which in turn uses our Weblogic appender to send the messages to the weblogic logs. Voila-- code can be portable ( no lockin to BEA), will run outside the app server, yet avoids the File IO restriction of EJBs....
If anybody is interested in the source code, I'll be happy to send it. Send email to thebluedirt at yahoo dot com. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 25 2001 11:45 EDT
- in response to Dave Cowden
But, the problem with that is, isn't it true that any uncaught exception goes to the weblogic log, but NOT to your log4j output??
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 25 2001 12:40 EDT
- in response to T J
Yes, that's true. Actually anything that weblogic logs will use its log directly. ( For example, startup logs, shutdown logs, administrative events, etc. ).
We use the Log4J as a logging mechanism to allow our EJBs to log without using fileIO _and_ without writing to weblogics logging framework. Uncaught exceptions would go into the weblogic log, but its pretty easy to make sure that never happens by catching all exceptions and handling them appropriately ( which should be done anyway, right? )
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 25 2001 15:20 EDT
- in response to Dave Cowden
Uncaught exceptions would go into the weblogic log, but its pretty easy to make sure that never happens by catching all exceptions and handling them appropriately ( which should be done anyway, right? )
Good luck catching every single possible point in a system where a nullpointer exception could possibly occur.
Also, if you have some of your logging going in one place and the rest of it in another, it seems like it would make it harder. The way our logging is set up, if an error occurs, we see a "history" of logging messages behind it that led up to that. If all our logging were going to our log file except some weird exception that happened in the weblogic log file, it would make it hard to tell what happened and what caused it. cya -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Toby Reyelts
- Posted on: May 25 2001 16:17 EDT
- in response to T J
Tracy Milburn wrote:
Good luck catching every single possible point in a system where a nullpointer exception could possibly occur.
Also, if you have some of your logging going in one place and the rest of it in another, it seems like it would make it harder.
-----------
Well, that's about as easy as writing:
try {
}
catch ( Throwable t ) {
}
Every good application should make sure that no exceptions escape unhandled.
Since no uncaught exceptions will be thrown, they won't be sent to the weblogic log file.
God bless,
-Toby Reyelts
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 25 2001 17:37 EDT
- in response to Toby Reyelts
Every good application should make sure that no exceptions escape unhandled.
What if the container throws an exception? We get socket reset by peer exceptions all the time in the logs, how would you catch those? They just appear. And what if the container throws an exception you have no control over; what if you get an exception because someone re-deployed an EJB? Not sure where you'd catch things like that.
Although the goal is to catch all exceptions, I've yet to see an application that did. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 26 2001 10:23 EDT
- in response to T J
looks like we're a bit off topic now, so this will be my last post on this exception topic.
Of course, you are correct. In addition to container exceptions, there are all sorts of weblogic "INFO" types of things that show up there too. I just meant that all of the code that _we_ write doesnt throw any uncaught exceptions. Running WLS for a while, it does throw log some exceptions ( but it catches them and prints stack traces to the logs ). None of these exceptions are "uncaught" either. That sort of stuff is why we chose to re-direct log4j logging events into the weblogic log instead of trying to send our events to a separate log file and somehow move the weblogic events into it.
BTW, we've been running a production application on WLS for a couple of months now-- we dont see any uncaught exceptions at all. The worst case is that the very top level handlers catch the exception and then print a stack trace out. Keep in mind that there is a big difference between "handling" and exception and "catching" an exception. Our application _never_ throws uncaught exceptions to its container ( whether that container happens to be standard VM or an appserver). The worst possible case is that they bubble up to the last level, which catches Throwable and then logs the stack trace.
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 25 2001 17:01 EDT
- in response to T J
Luck doesnt have much to do with it-- it's part of writing good software ;) -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 25 2001 17:10 EDT
- in response to T J
Tracy:
I think you may misunderstand how our setup works. I agree that having multiple log files would be a pain. We use Log4J as the API that we write our code to, but when Log4J accepts logging events, all of them are re-directed to the weblogic logs. Thus, _all_ of our messages end up in a single log, the weblogic log. The real benefit is that we accomplish this without having to pollute all of our code with Weblogic-specific api references ( which is really handy when running test cases outside the app server ).
Dave -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 25 2001 17:32 EDT
- in response to Dave Cowden
I agree that having multiple log files would be a pain. We use Log4J as the API that we write our code to, but when Log4J accepts logging events, all of them are re-directed to the weblogic logs.
Ah, ok! I see, that makes sense. So, it isn't a matter of getting weblogic exceptions to go to your log, but rather that you send your exceptions to the webogic log.
What was set up here when I came, and i haven't bucked it so far, is that when we start the server, we nohup the output to a file, so that all exceptions, whether they're weblogic or our logging messages, go to the same file. Of course, a weblogic.log is still being built but we don't even need to look at it.
For logging I wrote a singleton that does that and various other things.
Take care, cya -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 26 2001 10:26 EDT
- in response to T J
we nohup the output to a file, so that all exceptions, whether they're weblogic or our logging messages, go to the same file
I'm interested in what you mean here. does this mean that you redirect output of the console to a file with the > operator? Where would your logging messages go if you did not "nohup the output to a file"?
I'm always interested in learning new ways to skin a cat.
Thanks
Dave -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: T J
- Posted on: May 29 2001 10:46 EDT
- in response to Dave Cowden
we nohup the output to a file, so that all exceptions, whether they're weblogic or our logging messages, go to the same file
>I'm interested in what you mean here.
Right, there's a script that starts the weblogic.Server and we nohup that script to a file so that all output, stack traces etc. go there. As far as I can tell it works pretty good. Although I made changes to the script the idea was in place when I got here. cya -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 29 2001 19:56 EDT
- in response to T J
Oh, ok. I gotcha. -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Dave Cowden
- Posted on: May 25 2001 17:06 EDT
- in response to Dave Cowden
Per popular request, here is a very basic Log4J to Weblogic
bridge. <cya>This code is offered as is with no warranty, support, or any of that stuff, implied or expressed. That means I wont support it, take any responsibility for your system messing up if you choose to use it, etc.</cya> that said, we've been running it in a production system for a couple of months without any problems.
You need to have the log4j and weblogic jars in your classpath for it to compile...
Hope this helps some folks-- Enjoy!
Dave
<!-- Begin Code -->
package util.log;
import org.apache.log4j.*;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.Layout;
import org.apache.log4j.TTCCLayout;
import weblogic.logging.NonCatalogLogger;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* This class is a wrapper to bridge between
* apache log4j and weblogic NoCat Logger.
* Colinx classes generally use log4j logging instead of using
* weblogic logging this appender allows classes to be configured
* to use weblogic events while still preserving code generality.
*
* In order to use this appender, log4J should be configured to
* use this appender in the configuration.
* This is most easily done using a startup Class that will
* do the basic configuration and include this appender.
*
*/
public class WeblogicLogAppender extends AppenderSkeleton
{
//store the weblogic logger object
private NonCatalogLogger _wlogger = null;
/**
* Create a new appender with default layout and source
*/
public WeblogicLogAppender()
{
this( null,null );
}
/**
* Create a new appender with default layout and source
*/
public WeblogicLogAppender(String source)
{
this ( source, null );
}
/**
* Create a new appender with default layout and source
*/
public WeblogicLogAppender(Layout layout)
{
this ( null, layout );
}
/**
* Create a new appender by specifying a layout
*/
public WeblogicLogAppender(String source, Layout layout)
{
//if no source is provided, supply one.
if ( source == null )
{
source = "Log4JBridge";
}
//store the layout-- create a new one if necessary
if (layout == null)
{
this.layout = new TTCCLayout();
}
else
{
this.layout = layout;
}
//create the weblogic logger
_wlogger = new NonCatalogLogger(source );
}
/**
* This appender requires a layout
*/
public boolean requiresLayout()
{
return true;
}
/**
* Actually do the logging. Note that at this point the Log4J framework
* has ensured that we should be acutally logging this item, so all we
* have to do is normalize the Log4J levels to the weblogic logger
* levels.
*/
protected void append(LoggingEvent event)
{
// First, format the log string so we can send it to NT.
StringWriter sw_writer = new StringWriter();
PrintWriter pw_writer = new PrintWriter(sw_writer);
pw_writer.print(layout.format(event));
pw_writer.close();
// Normalize the log message priority into the supported categories
if ( event.priority.equals(Priority.DEBUG ) )
{
if ( event.throwable != null )
_wlogger.debug(sw_writer.toString() , event.throwable);
else
_wlogger.debug(sw_writer.toString() );
}
else if ( event.priority.equals(Priority.INFO))
{
if ( event.throwable != null )
_wlogger.info(sw_writer.toString() , event.throwable);
else
_wlogger.info(sw_writer.toString() );
}
else if ( event.priority.equals(Priority.WARN ))
{
if ( event.throwable != null )
_wlogger.warning(sw_writer.toString() , event.throwable);
else
_wlogger.warning(sw_writer.toString() );
}
else if ( event.priority.equals(Priority.ERROR) ||
event.priority.equals(Priority.FATAL ) )
{
if ( event.throwable != null )
_wlogger.error(sw_writer.toString() , event.throwable);
else
_wlogger.error(sw_writer.toString() );
}
else //should not happen...
{
if ( event.throwable != null )
_wlogger.warning(sw_writer.toString() , event.throwable);
else
_wlogger.warning(sw_writer.toString() );
}
}
/**
* Close resources-- for the weblogic appender there are none.
*/
public void close()
{
/** Nothing needed here... */
}
} -
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Robin Sharp
- Posted on: September 10 2001 05:32 EDT
- in response to Ash Parikh
I have written a logging mechanism called JLogger which is a JDK1.2+ implementation of the new java.util.logging classes. I have also written a SwingConsoleHandler so you can view log records as they happen.
It is FREE for licence and distribution and can be found at: -
http://www.javelinsoft.com
We are currently using it on a couple of projects, for example, a Free UK recruitment website at: -
http://www.jobshive.com
-
Logging Mechanism for EJBs...[ Go to top ]
- Posted by: Matt Redman
- Posted on: October 03 2001 20:51 EDT
- in response to Ash Parikh
I am Using Weblogic 6.0 sp1, I use the weblogic NonCatalogLogger... like so:
<pre>
//Weblogic.Logging
import weblogic.logging.NonCatalogLogger;
public final class Test implements EntityBean {
// This is the logging object
private NonCatalogLogger log;
// Create the logger
log = new NonCatalogLogger("TEST-LOG");
// log to it - info, warn, debug, error
log.error("This is a test of the error level");
/*
*
* Your code in here - with logging..
*
*/
}
</pre>
Will produce the output:<br>
<4/10/2001 10:23:59> <ERROR> <TEST-LOG> <This is a test of the error level><br>
under the logging console...<br>
Hope this helps..