RE: help in deploying chainsaw V2 in the browser

2007-06-07 Thread Rao, Ashwini \(Ashwini\)
Hi,
Thanks for replying.
Actually since ours is a web based application. We were looking for
something which will run inside the browser itself. So it will somewhat
look like belonging to our application itself.

So according to what you are saying, it looks like it is pretty much
tougher to implement it that way. Is there any other way of doing it of
which you know?

 I have one more doubt about the same. How do we give the client , the
XML file for socket connection ? I was able to run it locally. Am not
able to find out a way of sending it to the client. We took out the jar
and modified the default.properties, eventhough we see that the location
for the remote file is set, it is still not working.
Any ideas ?

Thanks a lot for any inputs.
-Ashwini

-Original Message-
From: Paul Smith [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 08, 2007 3:28 AM
To: Log4J Users List
Subject: Re: help in deploying chainsaw V2 in the browser

Right now I don't think there's a simple and straightforward way of  
doing it.  You're talking about wrapping up Chainsaw as an applet.

Having said that, I'm not sure what that really gives you.. ?  Maybe  
I don't understand the use case properly?

cheers,

Paul Smith
On 07/06/2007, at 10:15 PM, Rao, Ashwini (Ashwini) wrote:

> Hi,
>
>  Our application uses jsp files extensively. What I want to do now is,
> want to make the chainsaw V2 to appear inside the browser.
>
> Maybe like provide a link or a button and the application runs inside
> the browser and not as a separate one from the browser.
>
> Will it be possible to do this ? Or is there any alternative other  
> than
> using the link to jnlp which launches the application ?
>
> In need of urgent help!...
>
>
>
> Thanks
>
> Ashwini
>
>
>

Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: [EMAIL PROTECTED]  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to  
copyright or other applicable law. No confidentiality or privilege is  
lost by an erroneous transmission. If you have received this e-mail  
in error, please let us know by reply e-mail and delete or destroy  
this mail and all copies. If you are not the intended recipient of  
this message you must not disseminate, copy or take any action in  
reliance on it. The sender takes no responsibility for the effect of  
this message upon the recipient's computer system.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Logging Strategy: Using multiple Loggers in same Class file

2007-06-07 Thread sach.jain

Thanks.. Yeah, I was too thinking of putting at some central place. 

-Original Message-
From: Wyss Patrick [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 07, 2007 9:17 PM
To: Log4J Users List
Subject: AW: Logging Strategy: Using multiple Loggers in same Class file

> > 2 Logger.getLogger in my class files. It solves my purpose but just 
> > wondering if my approach is fine?
> 
> 
> It's perfect :-)
> 

i'd put either the String "JobStatus" or the whole logger somewhere
central like into a singleton (to make sure you can change the loggers
name easily) but this is rather a question of taste, i guess


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unable to call doRender. Am I missing anything? Please help

2007-06-07 Thread Naider Chen
Hi Curt:

Thanks for your clarification on this.  I'm really
appreciate.  At least I know where to focus now.

I need to capture all log4j rendered message as String
and remove something from the message if necessary to
address an issue of log injection attack.

I can get the same kind of your results now after
making some changes to that render example.  But the
String has been bypassed in the doRender.   I have
tried the



  


  

I'll start to look what I can do with Layouts for the
message %m.  I'm new to this area and I'm not sure
where to start with Layouts to intercept the %m in the
Layouts but I'll start to do some searching for it.

Can Layouts be able to alter message or if I can get a
quick example to see how to use it to get to the
message part.  Also can I do something so that Layouts
can be extended to apply to all the appender in one
shot or I need to customize the Layout for each
Appender?

Thanks again for your assistance.

Naider

--- Curt Arnold <[EMAIL PROTECTED]> wrote:

> 
> On Jun 6, 2007, at 9:59 AM, Naider Chen wrote:
> 
> > Hi:
> >
> > Can any one confirm to me it's working to call
> > doRender() method.  I'll appreciate if you can
> provide
> > me a successful example if you do make it work.  I
> use
> > log4j-1.2.14 in RAD6 and put log4j.xml in the
> > WEB-INF/classes folder and I'm sure the added
> >  has been loaded.
> 
> 
> There is an ORTestCase in the test suite (and which
> currently  
> passes), but the tests are inadequate to ensure that
> doRender is  
> being called in normal processing.
> 
> >
> > I tried the complete example from
> >
> > http://www.java2s.com/Code/Java/Language-Basics/ 
> > log4jAcompleteexample.htm
> >
> >
> > but the doRender() was never got called and it's
> not
> > calling to my own test to add  to the
> > log4j.xml and extend ObjectRenderer in my render
> class
> > with doRender() method.
> >
> > I just have to know if this is the right way to
> call
> > doRender() and capture the message to change it.
> 
> There are a multitude of errors in that sample, but
> if you fix all of  
> them, the OrderRenderer.doRender is called using
> log4j 1.2.14.  To  
> get the sample to run, I needed to:
> 
> Remove non-breaking spaces from the source
> Make all the classes "public" and place them in
> separate files named  
> after the classes.
> Extract the sample configuration file from the end
> of the sample and  
> name it log4j.xml
> Remove the asterisks used to comment out the
> configuration file
> remove the space between  and 
> Change the name of the logger in the configuration
> from  
> "com.apress.logging.log4j" to "name"
> Remove all the com.apress.* package names from the
> configuration file  
> since the Java source did not have any package
> statements.
> 
> If you did that, the output of the sample program
> was:
> 
> main INFO  name - Beer-101-20
> main INFO  name - Chocolate-223-5
> 
> If you commented out the renderer element, you got:
> 
> main INFO  name - [EMAIL PROTECTED]
> main INFO  name - [EMAIL PROTECTED]
> 
> >
> > I tried what Ron has suggested me to use
> LoggingEvent
> > object to filter the message to do getMessage()
> and
> > getRenderedMessage().  but it's not good to me
> since
> > there are no setRenderedMessage() to alter the
> message
> > that I want to return.
> >
> 
> >
> >
> > --- Naider Chen <[EMAIL PROTECTED]> wrote:
> >
> >> Thanks Ron:
> >>
> >> Thank you for your reply and I really appreciate
> it.
> >>
> >>
> >> May be The getRenderedMessage method in the
> >> LoggingEvent is another place that I can
> intercept
> >> the
> >> log message.  But I'm just beginning to look how
> to
> >> use log4j and I need to do some more research to
> >> find
> >> out how do I overwrite the getRenderedMessage
> method
> >> to scan and pre-process the message.  Can I
> extend
> >> the
> >> LoggingEvent and do something to have log4j use
> my
> >> child LoggingEvent method so that I can do what I
> >> need
> >> to do with the message.
> >>
> >>
> >> What I really need to do is to create a utilities
> to
> >> be used to plug in to the application code so
> that
> >> all
> >> the log message can be scanned/pre-processed
> before
> >> sending to the Appender.  And of course the
> >> application code need to do the little the
> better.
> >>
> 
> You needs would appear to be better served with
> either a Filter or  
> Layout.  An object renderer would only get invoked
> when a object  
> other than a String is passed as the message and
> custom renderer is  
> associated with the type.  Filters or Layouts would
> see all logging  
> requests, an ObjectRenderer would only see the
> subset that uses your  
> special type.
> 
> >>
> >> I'm sure the added  tag in my log4j.xml
> is
> >> loaded in my server but what I don't understand
> is
> >> that the doRender method is not get called. 
> Could
> >> that be because a String object is been bypassed
> >> because it's already a String so that there is no
> >> need
> >> 

Re: help in deploying chainsaw V2 in the browser

2007-06-07 Thread Paul Smith
Right now I don't think there's a simple and straightforward way of  
doing it.  You're talking about wrapping up Chainsaw as an applet.


Having said that, I'm not sure what that really gives you.. ?  Maybe  
I don't understand the use case properly?


cheers,

Paul Smith
On 07/06/2007, at 10:15 PM, Rao, Ashwini (Ashwini) wrote:


Hi,

 Our application uses jsp files extensively. What I want to do now is,
want to make the chainsaw V2 to appear inside the browser.

Maybe like provide a link or a button and the application runs inside
the browser and not as a separate one from the browser.

Will it be possible to do this ? Or is there any alternative other  
than

using the link to jnlp which launches the application ?

In need of urgent help!...



Thanks

Ashwini





Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: [EMAIL PROTECTED]  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to  
copyright or other applicable law. No confidentiality or privilege is  
lost by an erroneous transmission. If you have received this e-mail  
in error, please let us know by reply e-mail and delete or destroy  
this mail and all copies. If you are not the intended recipient of  
this message you must not disseminate, copy or take any action in  
reliance on it. The sender takes no responsibility for the effect of  
this message upon the recipient's computer system.






Re: Unable to call doRender. Am I missing anything? Please help

2007-06-07 Thread Curt Arnold


On Jun 6, 2007, at 9:59 AM, Naider Chen wrote:


Hi:

Can any one confirm to me it's working to call
doRender() method.  I'll appreciate if you can provide
me a successful example if you do make it work.  I use
log4j-1.2.14 in RAD6 and put log4j.xml in the
WEB-INF/classes folder and I'm sure the added
 has been loaded.



There is an ORTestCase in the test suite (and which currently  
passes), but the tests are inadequate to ensure that doRender is  
being called in normal processing.




I tried the complete example from

http://www.java2s.com/Code/Java/Language-Basics/ 
log4jAcompleteexample.htm



but the doRender() was never got called and it's not
calling to my own test to add  to the
log4j.xml and extend ObjectRenderer in my render class
with doRender() method.

I just have to know if this is the right way to call
doRender() and capture the message to change it.


There are a multitude of errors in that sample, but if you fix all of  
them, the OrderRenderer.doRender is called using log4j 1.2.14.  To  
get the sample to run, I needed to:


Remove non-breaking spaces from the source
Make all the classes "public" and place them in separate files named  
after the classes.
Extract the sample configuration file from the end of the sample and  
name it log4j.xml

Remove the asterisks used to comment out the configuration file
remove the space between  and 
Change the name of the logger in the configuration from  
"com.apress.logging.log4j" to "name"
Remove all the com.apress.* package names from the configuration file  
since the Java source did not have any package statements.


If you did that, the output of the sample program was:

main INFO  name - Beer-101-20
main INFO  name - Chocolate-223-5

If you commented out the renderer element, you got:

main INFO  name - [EMAIL PROTECTED]
main INFO  name - [EMAIL PROTECTED]



I tried what Ron has suggested me to use LoggingEvent
object to filter the message to do getMessage() and
getRenderedMessage().  but it's not good to me since
there are no setRenderedMessage() to alter the message
that I want to return.






--- Naider Chen <[EMAIL PROTECTED]> wrote:


Thanks Ron:

Thank you for your reply and I really appreciate it.


May be The getRenderedMessage method in the
LoggingEvent is another place that I can intercept
the
log message.  But I'm just beginning to look how to
use log4j and I need to do some more research to
find
out how do I overwrite the getRenderedMessage method
to scan and pre-process the message.  Can I extend
the
LoggingEvent and do something to have log4j use my
child LoggingEvent method so that I can do what I
need
to do with the message.


What I really need to do is to create a utilities to
be used to plug in to the application code so that
all
the log message can be scanned/pre-processed before
sending to the Appender.  And of course the
application code need to do the little the better.



You needs would appear to be better served with either a Filter or  
Layout.  An object renderer would only get invoked when a object  
other than a String is passed as the message and custom renderer is  
associated with the type.  Filters or Layouts would see all logging  
requests, an ObjectRenderer would only see the subset that uses your  
special type.




I'm sure the added  tag in my log4j.xml is
loaded in my server but what I don't understand is
that the doRender method is not get called.  Could
that be because a String object is been bypassed
because it's already a String so that there is no
need
to render it again?
I thought the doRender(object
o)
will catch all the object.  Is this right?


It this doRender approach the deadend to intercept
the
message or I can still catch a String object in
doRender?



There is a check in LoggingEvent.getRenderedMessage() that bypasses  
rendering if the message is already a string.  That behavior can't be  
changed at this date.  You can't use an ObjectRenderer to manipulate  
the message, however you may be able to use a Layout to get what you  
want.




I have changed the renderedClass="java.lang.Object"
to
Object instead of String but it's the same thing
doRender method print statement can't be found in my
consoleAppender.


The rendered class is used as a key into a map of renders in  
org.apache.log4j.or.RendererMap.findAndRender().  When searching for  
a renderer the value from msg.getClass() is used on the lookup, so a  
Renderer will only match precisely the class specified as the  
rendered class.  So if a renderer is registered for  
"java.lang.Object", the renderer would only get invoked if you were  
making calls like:


logger.debug(new Object());



http://jakarta.apache.org/log4j/";
  debug="true">
  


Here's the ocnsole log that shows the new 
tag showned in the logger.

[6/1/07 15:28:09:453 EDT] 002a SystemOut O
log4j: Rendering class: [test.log4j.LogCatcher],
Rendered class: [java.lang.Object].
[6/1/07 15:28:09:453 EDT] 002a SystemOut O
log4j: Level value for r

JDBCAppender custom fields

2007-06-07 Thread Shah, Tejas

Hello,

I am using JDBCAppender to log information into a database. I need to
log several custom fields along with logging message and default fields
provided by JDBCAppender. I have searched about this issue and found out
a post from 2003 which does outline an alternative approach using
ExtendedPatternLayout. My question is if there is an easier way to
accomplish this. I mean easier than writing few lines of code which
would parse message string for fields and would just do a database
insert? 


Thanks for your help,

Tejas
***
The information in this email is confidential and may be legally privileged 
Access to this email by anyone other than the intended addressee is 
unauthorized. If you are not the intended recipient of this message, any 
review, disclosure, copying, distribution, retention, or any action taken or 
omitted to be taken in reliance on it is prohibited and may be unlawful. If you 
are not the intended recipient, please reply to or forward a copy of this 
message to the sender and delete the message, any attachments, and any copies 
thereof from your system.
***

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to disable framework logging

2007-06-07 Thread James Stauffer

AFAIK the root logger should be the last logger.  BTW "category" has
been superseeded by "logger"

On 6/7/07, jsobieski <[EMAIL PROTECTED]> wrote:


Hi,

I am having problem with Tapestry framework logging lots of debug statements
but I guess this question is more generic, in how to disable logging for any
framework that my code may be using.

My web application is built on top of Tapestry and I want to see only my
application's log statements. Tapestry is using "org.apache.tapestry"
namespace and so I configured my log4j.xml as following:




http://jakarta.apache.org/log4j/";>

  




  

  
  






  

  
  






  

  


  

  


  

  


  



Yet, Tapestry is still logging at DEBUG into my application's log file
(prodc.log). Is my configuration incorrect or what else may I be doing
wrong?

Thanks, Jessica.
--
View this message in context: 
http://www.nabble.com/how-to-disable-framework-logging-tf3884588.html#a11010395
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
James Staufferhttp://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Logging Strategy: Using multiple Loggers in same Class file

2007-06-07 Thread Wyss Patrick
> > 2 Logger.getLogger in my class files. It solves my purpose but just
> > wondering if my approach is fine?
> 
> 
> It's perfect :-)
> 

i'd put either the String "JobStatus" or the whole logger somewhere central 
like into a singleton (to make sure you can change the loggers name easily) but 
this is rather a question of taste, i guess


RE: public interface ErrorHandler extends OptionHandler

2007-06-07 Thread Kamal Ahmed
Never mind, I found it

public class OnlyOnceErrorHandler implements ErrorHandler



-Original Message-
From: Kamal Ahmed [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 07, 2007 11:22 AM
To: Log4J Users List
Subject: public interface ErrorHandler extends OptionHandler 

Hi,

In Log4J version 1.2.13 , I could not find any implementation of
ErrorHandler. Is it upto the user to implement ErrorHandler interface?

Thanks,
-Kamal.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



how to disable framework logging

2007-06-07 Thread jsobieski

Hi,

I am having problem with Tapestry framework logging lots of debug statements
but I guess this question is more generic, in how to disable logging for any
framework that my code may be using.

My web application is built on top of Tapestry and I want to see only my
application's log statements. Tapestry is using "org.apache.tapestry"
namespace and so I configured my log4j.xml as following:




http://jakarta.apache.org/log4j/";>

   
 
 
   
 
   

  
  




  

  

  
  




  

  

   
 
 
  
  
  


  
  
  


  
  


Yet, Tapestry is still logging at DEBUG into my application's log file
(prodc.log). Is my configuration incorrect or what else may I be doing
wrong?

Thanks, Jessica.
-- 
View this message in context: 
http://www.nabble.com/how-to-disable-framework-logging-tf3884588.html#a11010395
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



public interface ErrorHandler extends OptionHandler

2007-06-07 Thread Kamal Ahmed
Hi,

In Log4J version 1.2.13 , I could not find any implementation of
ErrorHandler. Is it upto the user to implement ErrorHandler interface?

Thanks,
-Kamal.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Logging Strategy: Using multiple Loggers in same Class file

2007-06-07 Thread Maarten Bosteels

On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:



Hi,

In my application, I wanted to use logging this way:

1. Use general log4j logging statement which goes to a project log file
(It works fine).  For e.g logger.getLogger( "ToolCli.class" );

2. A special log which needs to be written to a separate file. Here we
are not concerned about the log levels. We need only one level.
Basically we need to log the summary of a particular transaction of our
application. And those log statement for that particular transaction
would come from different Java class files.

To achive this I create another unique named logger and get this logger
in the classes wherever I wanted to use it. This would result in having
2 Logger.getLogger in my class files. It solves my purpose but just
wondering if my approach is fine?



It's perfect :-)

Naming your loggers after your classes is a very common pattern.
But log4j is designed to support your use case too.

Maarten

Please provide if you have any comments/suggestions. Thanks.


Below is the sample code snippet:

public class ToolCli
{
   private static Logger logger = Logger.getLogger( "ToolCli.class );
   private static Logger statusLogger = Logger.getLogger( "JobStatus" );

   void myMethod() {
   statusLogger.info("Started Job...");
   }
   void myMethod2() {
   logger.info("something to be logged...");
   }

}

public class JobHandler
{
   private static Logger logger = Logger.getLogger( "JobHandler.class );
   private static Logger statusLogger = Logger.getLogger( "JobStatus" );

   void myMethod() {
   statusLogger.info("Aborted Job...");
   }
   void myMethod2() {
   logger.info("something to be logged...");
   }

}

In log4j.xml  apart from root logger JobStatus is defined as :

   
  
  
   

  
  
  
  


The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s) and
may contain proprietary, confidential or privileged information. If you are
not the intended recipient, you should not disseminate, distribute or copy
this e-mail. Please notify the sender immediately and destroy all copies of
this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses. The
company accepts no liability for any damage caused by any virus transmitted
by this email.

www.wipro.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Logging Strategy: Using multiple Loggers in same Class file

2007-06-07 Thread Dave Levitt

Wouldn't that application be the sort of thing to use 'nested
diagnostic context' on?

NDC.push("filterable trans start message");

and pop the context in the 'finally' after the commit or rollback.

On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


Hi,

In my application, I wanted to use logging this way:

1. Use general log4j logging statement which goes to a project log file
(It works fine).  For e.g logger.getLogger( "ToolCli.class" );

2. A special log which needs to be written to a separate file. Here we
are not concerned about the log levels. We need only one level.
Basically we need to log the summary of a particular transaction of our
application. And those log statement for that particular transaction
would come from different Java class files.

To achive this I create another unique named logger and get this logger
in the classes wherever I wanted to use it. This would result in having
2 Logger.getLogger in my class files. It solves my purpose but just
wondering if my approach is fine?

Please provide if you have any comments/suggestions. Thanks.

Below is the sample code snippet:

public class ToolCli
{
   private static Logger logger = Logger.getLogger( "ToolCli.class );
   private static Logger statusLogger = Logger.getLogger( "JobStatus" );

   void myMethod() {
   statusLogger.info("Started Job...");
   }
   void myMethod2() {
   logger.info("something to be logged...");
   }

}

public class JobHandler
{
   private static Logger logger = Logger.getLogger( "JobHandler.class );
   private static Logger statusLogger = Logger.getLogger( "JobStatus" );

   void myMethod() {
   statusLogger.info("Aborted Job...");
   }
   void myMethod2() {
   logger.info("something to be logged...");
   }

}

In log4j.xml  apart from root logger JobStatus is defined as :

   
  
  
   

  
  
  
  


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



help in deploying chainsaw V2 in the browser

2007-06-07 Thread Rao, Ashwini \(Ashwini\)
Hi,

 Our application uses jsp files extensively. What I want to do now is,
want to make the chainsaw V2 to appear inside the browser.

Maybe like provide a link or a button and the application runs inside
the browser and not as a separate one from the browser.

Will it be possible to do this ? Or is there any alternative other than
using the link to jnlp which launches the application ?

In need of urgent help!...

 

Thanks

Ashwini

 



Logging Strategy: Using multiple Loggers in same Class file

2007-06-07 Thread sach.jain

Hi,

In my application, I wanted to use logging this way:

1. Use general log4j logging statement which goes to a project log file
(It works fine).  For e.g logger.getLogger( "ToolCli.class" );

2. A special log which needs to be written to a separate file. Here we
are not concerned about the log levels. We need only one level.
Basically we need to log the summary of a particular transaction of our
application. And those log statement for that particular transaction
would come from different Java class files. 

To achive this I create another unique named logger and get this logger
in the classes wherever I wanted to use it. This would result in having
2 Logger.getLogger in my class files. It solves my purpose but just
wondering if my approach is fine? 

Please provide if you have any comments/suggestions. Thanks.

Below is the sample code snippet:

public class ToolCli
{
   private static Logger logger = Logger.getLogger( "ToolCli.class );
   private static Logger statusLogger = Logger.getLogger( "JobStatus" );

   void myMethod() {
   statusLogger.info("Started Job..."); 
   }
   void myMethod2() {
   logger.info("something to be logged..."); 
   }

}

public class JobHandler
{
   private static Logger logger = Logger.getLogger( "JobHandler.class );
   private static Logger statusLogger = Logger.getLogger( "JobStatus" );

   void myMethod() {
   statusLogger.info("Aborted Job..."); 
   }
   void myMethod2() {
   logger.info("something to be logged..."); 
   }

}

In log4j.xml  apart from root logger JobStatus is defined as :

   
  
  


  
  
  
  


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]