can anyone explain

2003-08-06 Thread narasimharao konjeti
can anyone explain, In my project there are .class
files, we are rising some exceptions in that
classfiles, and we are appling apache logger concept
for the java product to handle logging messages, like
exceptions and all..

regards
nr konjeti


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Can anyone explain this?

2002-07-24 Thread Isaac.Goldstein

Hi.

I need to dynamically define the name of my RollingFileAppender (We have
amny environments and I don't want to have to keep on changing the config
file).  Since I also don't want the headache of maintaining system
properties I decided on doing it via the code as follows:

System.setProperty(logFile.name, getServletContext().getRealPath
(/WEB-INF/logs) + \\test.log);

The config file looks like this:

appender name=A2 class=org.apache.log4j.DailyRollingFileAppender
   param name=Append value=true/
   param name=File value=${logFile.name}/


This works because all our environments conform to the Servlets 2.1
directory specs.

What's wierd is that even though I define the Append attribute to true,
log4j still truncates the file each time the servlet engine is bounced.  If
I hard-code the file name in the config file it works fine (even if I
hard-code the absolute path).

Can anyone explain this?

Thank you.


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




Re: Can anyone explain this?

2002-07-24 Thread Ceki Gülcü

At 10:27 24.07.2002 -0400, you wrote:
Hi.

I need to dynamically define the name of my RollingFileAppender (We have
amny environments and I don't want to have to keep on changing the config
file).  Since I also don't want the headache of maintaining system
properties I decided on doing it via the code as follows:

System.setProperty(logFile.name, getServletContext().getRealPath
(/WEB-INF/logs) + \\test.log);

The config file looks like this:

appender name=A2 class=org.apache.log4j.DailyRollingFileAppender
param name=Append value=true/
param name=File value=${logFile.name}/


This works because all our environments conform to the Servlets 2.1
directory specs.

What's wierd is that even though I define the Append attribute to true,
log4j still truncates the file each time the servlet engine is bounced.  If
I hard-code the file name in the config file it works fine (even if I
hard-code the absolute path).

Can anyone explain this?

Thank you.

What do you mean exactly by when the servlet engine is bounced?


--
Ceki

For complete log4j documentation please refer to http://qos.ch/log4jBook.html


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




Re: Can anyone explain this?

2002-07-24 Thread Isaac.Goldstein


I meant when I stop and start the server.

In any case, I figured out the problem.  Apparently log4j expects the
String representing the file path to have its path separators escaped.  In
other words the string i was passing in looked something like this c:
\jakarta4\webapps... and it expects c:\\jakarta4\\webapps  The code
I sent before should be revised to look like this (if using jdk1.4, you can
use regexp):

StringBuffer fileName = new StringBuffer(getServletContext().getRealPath
(/WEB-INF/logs) + \\test.log);

for (int i = 0 ; i  fileName.length() ; i++){
  if ( fileName.charAt(i) == '\\'){
 fileName.insert(i, '\\');
 i++;  //jump ahead - infinite loop otherwise
  }
}

System.setProperty(logFile.name, fileName.toString());

Now everything works fine.

Ceki, in jdk1.4 logging, you specify file paths by using the forward slash
which is then replaced by them to use the system file separator.  Does
log4j envisage something like that?  Do you think the code listed above is
future-version safe?

Isaac



   
 
Ceki Gülcü 
 
[EMAIL PROTECTED]To: Log4J Users List
 
  [EMAIL PROTECTED]  
 
07/24/2002   cc:   
 
10:57 AM Subject: Re: Can anyone explain this? 
 
Please respond 
 
to Log4J  
 
Users List
 
   
 
   
 




At 10:27 24.07.2002 -0400, you wrote:
Hi.

I need to dynamically define the name of my RollingFileAppender (We have
amny environments and I don't want to have to keep on changing the config
file).  Since I also don't want the headache of maintaining system
properties I decided on doing it via the code as follows:

System.setProperty(logFile.name, getServletContext().getRealPath
(/WEB-INF/logs) + \\test.log);

The config file looks like this:

appender name=A2 class=org.apache.log4j.DailyRollingFileAppender
param name=Append value=true/
param name=File value=${logFile.name}/


This works because all our environments conform to the Servlets 2.1
directory specs.

What's wierd is that even though I define the Append attribute to
true,
log4j still truncates the file each time the servlet engine is bounced
--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re[2]: Can anyone explain this?

2002-07-24 Thread Jacob Kjome


What's weird is that if the escaped backslashes are needed, why does
the file get written to in the first place?  Log4j , obviously, finds
the file and is able to write to it.  The Append thing doesn't, on
the face of it, seem like it should be related to using escaped
backslashes or not.

A real explanation of what is going on here is definitely needed.  I
use a similar mechanism for setting the path to log files in servlets,
but I use a regular FileAppender and have Append set to false, so I've
never experienced this bug.  However, if I make the switch to Appending
the file, I'd sure like it to work, so I'd definitely be interested in
whether I'd be required to use Isaac's work-around.

Jake

Wednesday, July 24, 2002, 10:15:15 AM, you wrote:


IGnfo I meant when I stop and start the server.

IGnfo In any case, I figured out the problem.  Apparently log4j expects the
IGnfo String representing the file path to have its path separators escaped.  In
IGnfo other words the string i was passing in looked something like this c:
IGnfo \jakarta4\webapps... and it expects c:\\jakarta4\\webapps  The code
IGnfo I sent before should be revised to look like this (if using jdk1.4, you can
IGnfo use regexp):

IGnfo StringBuffer fileName = new StringBuffer(getServletContext().getRealPath
IGnfo (/WEB-INF/logs) + \\test.log);

IGnfo for (int i = 0 ; i  fileName.length() ; i++){
IGnfo   if ( fileName.charAt(i) == '\\'){
IGnfo  fileName.insert(i, '\\');
IGnfo  i++;  //jump ahead - infinite loop otherwise
IGnfo   }
IGnfo }

IGnfo System.setProperty(logFile.name, fileName.toString());

IGnfo Now everything works fine.

IGnfo Ceki, in jdk1.4 logging, you specify file paths by using the forward slash
IGnfo which is then replaced by them to use the system file separator.  Does
IGnfo log4j envisage something like that?  Do you think the code listed above is
IGnfo future-version safe?

IGnfo Isaac



   
 
IGnfo Ceki Gülcü  

IGnfo [EMAIL PROTECTED]To: Log4J Users List 

IGnfo   [EMAIL PROTECTED]   

IGnfo 07/24/2002   cc:

IGnfo 10:57 AM Subject: Re: Can anyone explain 
this?  
IGnfo Please respond  

IGnfo to Log4J   

IGnfo Users List 

   
 
   
 




IGnfo At 10:27 24.07.2002 -0400, you wrote:
Hi.

I need to dynamically define the name of my RollingFileAppender (We have
amny environments and I don't want to have to keep on changing the config
file).  Since I also don't want the headache of maintaining system
properties I decided on doing it via the code as follows:

System.setProperty(logFile.name, getServletContext().getRealPath
(/WEB-INF/logs) + \\test.log);

The config file looks like this:

appender name=A2 class=org.apache.log4j.DailyRollingFileAppender
param name=Append value=true/
param name=File value=${logFile.name}/


This works because all our environments conform to the Servlets 2.1
directory specs.

What's wierd is that even though I define the Append attribute to
IGnfo true,
log4j still truncates the file each time the servlet engine is bounced
IGnfo --
IGnfo To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
IGnfo For additional commands, e-mail: mailto:[EMAIL PROTECTED]



-- 
Best regards,
 Jacobmailto:[EMAIL PROTECTED]


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