You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ceki Gülcü <ce...@qos.ch> on 2002/11/08 09:20:16 UTC

RE: org.apache.log4j.net.SocketAppender - Help with setLocationIn fo

log4j location info behavior does NOT depend on the JDK, at least not on 
1.3 or 1.4.

At 11:47 08.11.2002 +1000, you wrote:
>Figured this one out,
>
>I'm using Jdev9i 9.0.3
>It lets you choose which version of java to use, in the projects where
>location is not working they are using 1.3
>In the projects where it does work it is using 1.4
>
>Nicholas Orr
>
>-----Original Message-----
>From: Nicholas Orr [mailto:Nicholas.Orr@mim.com.au]
>Sent: Friday, 8 November 2002 11:19 AM
>To: Log4j Mailing List
>Subject: org.apache.log4j.net.SocketAppender - Help with setLocationInfo
>
>
>Hi,
>
>I have just started to use Log4j and am having an inconsistency problem.
>
>My log4j.properties file looks like this
>
>log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
>log4j.appender.CHAINSAW_CLIENT.LocationInfo=true
>log4j.appender.CHAINSAW_CLIENT.Port=4445
>log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
>log4j.rootLogger=DEBUG, CHAINSAW_CLIENT
>
>I use this for debugging.  In one project I get location info but in another
>one I don't get location info. What is going on??
>
>Here is the code I'm using in both
>
><--- start code --->
>
>package com.move.cool;
>
>import org.apache.log4j.*;
>
>public class LogMe  {
>   private static Logger log = Logger.getLogger(LogMe.class.getName());
>
>   public LogMe() {
>
>     log.info("--Hello1");
>     log.info("--Hello3");
>     log.error("--Hello5");
>     log.warn("--Hello6");
>     log.error("MAJOR PROBLEM");
>     System.out.println("End");
>   }
>
>
>   public static void main(String[] args) {
>     System.out.println("Begin");
>     LogMe logMe = new LogMe();
>     System.out.println("End");
>   }
>}
>
><--- end code --->
>
>
>
>**********************************************************************
>The information contained in this e-mail is confidential and is intended
>only for the use of the addressee(s). If you receive this e-mail in error,
>any use, distribution or copying of this e-mail is not permitted. You are
>requested to forward unwanted e-mail and address any problems to the MIM
>Holdings Limited Support Centre.
>
>For general enquires:   ++61 7 3833 8000
>Support Centre e-mail:  supportcentre@mim.com.au
>Support Centre phone:   Australia 1800500646
>                                         International ++61 7 38338042
>**********************************************************************
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Query

Posted by Rubal Sher <rs...@velankani.com>.
Thanks for the info. Can you please tell me though how I could use a ":"
(colon) as part of a filename ?? Or if a colon can be used at all?

Regards,
Rubal.
----- Original Message -----
From: "Ceki Gülcü" <ce...@qos.ch>
To: "Log4J Users List" <lo...@jakarta.apache.org>
Sent: Friday, November 08, 2002 3:35 PM
Subject: Re: Query



Log4j 1.3 is not yet available. It might go alpha in December or January
2003 or maybe later... :-)

To follow development more closely you can subscribe to the log4j-dev list.

At 14:29 08.11.2002 +0530, you wrote:
>Thanks, I am using version 1.2.7
>This is what I downloaded from the log4j website.
>
>Is version 1.3 available since 1.2.7 seems to be the latest on their
>website? If it is available, where can I get it from?
>
>Regards,
>Rubal.
>
>----- Original Message -----
>From: "Ceki Gülcü" <ce...@qos.ch>
>To: "Log4J Users List" <lo...@jakarta.apache.org>
>Sent: Friday, November 08, 2002 2:17 PM
>Subject: Re: Query
>
>
> >
> > This will be possible in version log4j 1.3. In 1.2 you have to do it
>yourself.
> >
> > At 14:10 08.11.2002 +0530, you wrote:
> > >Hi all -
> > >
> > >I am new to log4j and the mailing list. I have a query and I would
> > >appreciate if anyone can post a reply.
> > >
> > >My requirement is that  I need to have my log file names as per the
> > >following format:
> > >file_MMDDYYYY_hh:mm:ss
> > >where "file_" is a fixed string, MM denotes month of the year, DD
denotes
> > >the date of the month, YYYY denotes the year, "hh" denotes the hour of
>the
> > >day, "mm" denotes the minute of the hour and "ss" denotes the seconds.
> > >
> > >This seems to be simple to implement if I use the
> > >"DailyRollingFileAppender". The problem is that the file I write to
>should
> > >roll over ONLY at midnight. If I set the "DateFormat" to roll over at
> > >midnight, then I do not get the "hh:mm:ss" appended to the file.
> > >Furthermore, how do I use a colon in the filename above??
> > >
> > >I have an additional requirement. In addition to having the file rolled
>over
> > >daily at midnight, I also need to specify a max file size for each
file.
>I
> > >understand that the maximum file size can be implemented using the
> > >"RollingFileAppender". So, do I use the RollingFileAppender or the
> > >DailyRollingFileAppender and is there any way I can configure log4j to
> > >integrate the above two desired features?
> > >
> > >This is the reason(max file size) why we have the "hh:mm:ss" field in
the
> > >filename, in addition to the date(although it rolls over only at
midnight
> > >provided the max file size is not reached). Can anyone help?
> > >
> > >Thanks and regards,
> > >Rubal.
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> > >For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
> > --
> > Ceki
> >
> > TCP implementations will follow a general principle of robustness: be
> > conservative in what you do, be liberal in what you accept from
> > others. -- Jon Postel, RFC 793
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> > For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Query

Posted by Ceki Gülcü <ce...@qos.ch>.
Log4j 1.3 is not yet available. It might go alpha in December or January 
2003 or maybe later... :-)

To follow development more closely you can subscribe to the log4j-dev list.

At 14:29 08.11.2002 +0530, you wrote:
>Thanks, I am using version 1.2.7
>This is what I downloaded from the log4j website.
>
>Is version 1.3 available since 1.2.7 seems to be the latest on their
>website? If it is available, where can I get it from?
>
>Regards,
>Rubal.
>
>----- Original Message -----
>From: "Ceki Gülcü" <ce...@qos.ch>
>To: "Log4J Users List" <lo...@jakarta.apache.org>
>Sent: Friday, November 08, 2002 2:17 PM
>Subject: Re: Query
>
>
> >
> > This will be possible in version log4j 1.3. In 1.2 you have to do it
>yourself.
> >
> > At 14:10 08.11.2002 +0530, you wrote:
> > >Hi all -
> > >
> > >I am new to log4j and the mailing list. I have a query and I would
> > >appreciate if anyone can post a reply.
> > >
> > >My requirement is that  I need to have my log file names as per the
> > >following format:
> > >file_MMDDYYYY_hh:mm:ss
> > >where "file_" is a fixed string, MM denotes month of the year, DD denotes
> > >the date of the month, YYYY denotes the year, "hh" denotes the hour of
>the
> > >day, "mm" denotes the minute of the hour and "ss" denotes the seconds.
> > >
> > >This seems to be simple to implement if I use the
> > >"DailyRollingFileAppender". The problem is that the file I write to
>should
> > >roll over ONLY at midnight. If I set the "DateFormat" to roll over at
> > >midnight, then I do not get the "hh:mm:ss" appended to the file.
> > >Furthermore, how do I use a colon in the filename above??
> > >
> > >I have an additional requirement. In addition to having the file rolled
>over
> > >daily at midnight, I also need to specify a max file size for each file.
>I
> > >understand that the maximum file size can be implemented using the
> > >"RollingFileAppender". So, do I use the RollingFileAppender or the
> > >DailyRollingFileAppender and is there any way I can configure log4j to
> > >integrate the above two desired features?
> > >
> > >This is the reason(max file size) why we have the "hh:mm:ss" field in the
> > >filename, in addition to the date(although it rolls over only at midnight
> > >provided the max file size is not reached). Can anyone help?
> > >
> > >Thanks and regards,
> > >Rubal.
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> > >For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
> > --
> > Ceki
> >
> > TCP implementations will follow a general principle of robustness: be
> > conservative in what you do, be liberal in what you accept from
> > others. -- Jon Postel, RFC 793
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> > For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Query

Posted by Rubal Sher <rs...@velankani.com>.
Thanks, I am using version 1.2.7
This is what I downloaded from the log4j website.

Is version 1.3 available since 1.2.7 seems to be the latest on their
website? If it is available, where can I get it from?

Regards,
Rubal.

----- Original Message -----
From: "Ceki Gülcü" <ce...@qos.ch>
To: "Log4J Users List" <lo...@jakarta.apache.org>
Sent: Friday, November 08, 2002 2:17 PM
Subject: Re: Query


>
> This will be possible in version log4j 1.3. In 1.2 you have to do it
yourself.
>
> At 14:10 08.11.2002 +0530, you wrote:
> >Hi all -
> >
> >I am new to log4j and the mailing list. I have a query and I would
> >appreciate if anyone can post a reply.
> >
> >My requirement is that  I need to have my log file names as per the
> >following format:
> >file_MMDDYYYY_hh:mm:ss
> >where "file_" is a fixed string, MM denotes month of the year, DD denotes
> >the date of the month, YYYY denotes the year, "hh" denotes the hour of
the
> >day, "mm" denotes the minute of the hour and "ss" denotes the seconds.
> >
> >This seems to be simple to implement if I use the
> >"DailyRollingFileAppender". The problem is that the file I write to
should
> >roll over ONLY at midnight. If I set the "DateFormat" to roll over at
> >midnight, then I do not get the "hh:mm:ss" appended to the file.
> >Furthermore, how do I use a colon in the filename above??
> >
> >I have an additional requirement. In addition to having the file rolled
over
> >daily at midnight, I also need to specify a max file size for each file.
I
> >understand that the maximum file size can be implemented using the
> >"RollingFileAppender". So, do I use the RollingFileAppender or the
> >DailyRollingFileAppender and is there any way I can configure log4j to
> >integrate the above two desired features?
> >
> >This is the reason(max file size) why we have the "hh:mm:ss" field in the
> >filename, in addition to the date(although it rolls over only at midnight
> >provided the max file size is not reached). Can anyone help?
> >
> >Thanks and regards,
> >Rubal.
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
> --
> Ceki
>
> TCP implementations will follow a general principle of robustness: be
> conservative in what you do, be liberal in what you accept from
> others. -- Jon Postel, RFC 793
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Query

Posted by Ceki Gülcü <ce...@qos.ch>.
This will be possible in version log4j 1.3. In 1.2 you have to do it yourself.

At 14:10 08.11.2002 +0530, you wrote:
>Hi all -
>
>I am new to log4j and the mailing list. I have a query and I would
>appreciate if anyone can post a reply.
>
>My requirement is that  I need to have my log file names as per the
>following format:
>file_MMDDYYYY_hh:mm:ss
>where "file_" is a fixed string, MM denotes month of the year, DD denotes
>the date of the month, YYYY denotes the year, "hh" denotes the hour of the
>day, "mm" denotes the minute of the hour and "ss" denotes the seconds.
>
>This seems to be simple to implement if I use the
>"DailyRollingFileAppender". The problem is that the file I write to should
>roll over ONLY at midnight. If I set the "DateFormat" to roll over at
>midnight, then I do not get the "hh:mm:ss" appended to the file.
>Furthermore, how do I use a colon in the filename above??
>
>I have an additional requirement. In addition to having the file rolled over
>daily at midnight, I also need to specify a max file size for each file. I
>understand that the maximum file size can be implemented using the
>"RollingFileAppender". So, do I use the RollingFileAppender or the
>DailyRollingFileAppender and is there any way I can configure log4j to
>integrate the above two desired features?
>
>This is the reason(max file size) why we have the "hh:mm:ss" field in the
>filename, in addition to the date(although it rolls over only at midnight
>provided the max file size is not reached). Can anyone help?
>
>Thanks and regards,
>Rubal.
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Query

Posted by Rubal Sher <rs...@velankani.com>.
Hi all -

I am new to log4j and the mailing list. I have a query and I would
appreciate if anyone can post a reply.

My requirement is that  I need to have my log file names as per the
following format:
file_MMDDYYYY_hh:mm:ss
where "file_" is a fixed string, MM denotes month of the year, DD denotes
the date of the month, YYYY denotes the year, "hh" denotes the hour of the
day, "mm" denotes the minute of the hour and "ss" denotes the seconds.

This seems to be simple to implement if I use the
"DailyRollingFileAppender". The problem is that the file I write to should
roll over ONLY at midnight. If I set the "DateFormat" to roll over at
midnight, then I do not get the "hh:mm:ss" appended to the file.
Furthermore, how do I use a colon in the filename above??

I have an additional requirement. In addition to having the file rolled over
daily at midnight, I also need to specify a max file size for each file. I
understand that the maximum file size can be implemented using the
"RollingFileAppender". So, do I use the RollingFileAppender or the
DailyRollingFileAppender and is there any way I can configure log4j to
integrate the above two desired features?

This is the reason(max file size) why we have the "hh:mm:ss" field in the
filename, in addition to the date(although it rolls over only at midnight
provided the max file size is not reached). Can anyone help?

Thanks and regards,
Rubal.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: org.apache.log4j.net.SocketAppender - Help with setLocationIn fo

Posted by gautam <ga...@applabs.net>.
Hello Folks,

I ran a few tests with Log4J 1.2.6. Used JDK 1.3.1_04 & 1.4. In both cases,
the location info is *dependent* on the "-g" command used to compile my Java
source. Also, you *must* have the "log4j.appender.<Appender
Name>.LocationInfo=true" flag set in order to see the location info.

In order to get location info, use the "-g:source,lines,vars" flag with
JavaC and set the "...LocationInfo=true" flag for your appenders in Log4J
properties. This is independent of the JDK version.

I have tested this with logging to LF5 & ChainSaw, using the SocketAppender
in both cases.

Please note that calculating the LocationInfo is very expensive and is not
recommended for production enviornments.

Regards,

Gautam Satpathy

-----Original Message-----
From: Ceki Gulcu [mailto:ceki@qos.ch]
Sent: Friday, November 08, 2002 1:50 PM
To: Log4J Users List
Subject: RE: org.apache.log4j.net.SocketAppender - Help with
setLocationIn fo



log4j location info behavior does NOT depend on the JDK, at least not on
1.3 or 1.4.

At 11:47 08.11.2002 +1000, you wrote:
>Figured this one out,
>
>I'm using Jdev9i 9.0.3
>It lets you choose which version of java to use, in the projects where
>location is not working they are using 1.3
>In the projects where it does work it is using 1.4
>
>Nicholas Orr
>
>-----Original Message-----
>From: Nicholas Orr [mailto:Nicholas.Orr@mim.com.au]
>Sent: Friday, 8 November 2002 11:19 AM
>To: Log4j Mailing List
>Subject: org.apache.log4j.net.SocketAppender - Help with setLocationInfo
>
>
>Hi,
>
>I have just started to use Log4j and am having an inconsistency problem.
>
>My log4j.properties file looks like this
>
>log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
>log4j.appender.CHAINSAW_CLIENT.LocationInfo=true
>log4j.appender.CHAINSAW_CLIENT.Port=4445
>log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
>log4j.rootLogger=DEBUG, CHAINSAW_CLIENT
>
>I use this for debugging.  In one project I get location info but in
another
>one I don't get location info. What is going on??
>
>Here is the code I'm using in both
>
><--- start code --->
>
>package com.move.cool;
>
>import org.apache.log4j.*;
>
>public class LogMe  {
>   private static Logger log = Logger.getLogger(LogMe.class.getName());
>
>   public LogMe() {
>
>     log.info("--Hello1");
>     log.info("--Hello3");
>     log.error("--Hello5");
>     log.warn("--Hello6");
>     log.error("MAJOR PROBLEM");
>     System.out.println("End");
>   }
>
>
>   public static void main(String[] args) {
>     System.out.println("Begin");
>     LogMe logMe = new LogMe();
>     System.out.println("End");
>   }
>}
>
><--- end code --->
>
>
>
>**********************************************************************
>The information contained in this e-mail is confidential and is intended
>only for the use of the addressee(s). If you receive this e-mail in error,
>any use, distribution or copying of this e-mail is not permitted. You are
>requested to forward unwanted e-mail and address any problems to the MIM
>Holdings Limited Support Centre.
>
>For general enquires:   ++61 7 3833 8000
>Support Centre e-mail:  supportcentre@mim.com.au
>Support Centre phone:   Australia 1800500646
>                                         International ++61 7 38338042
>**********************************************************************
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: log4j messages to String conversion?

Posted by Dirk Hopmann <ho...@c-lab.de>.
Hi,

I just want to send the completely formatted string (like: '0 [main]
com.foo.bar - this is the message') via an RMI connection, that is already
implemented and must be used...

My problem is, that the output string is only send to the console and I am
not able to convert it to a String, to use it in my program.

Regards,
Dirk Hopmann



----- Original Message -----
From: "Ricardo Moral" <ri...@yahoo.com>
To: "Log4J Users List" <lo...@jakarta.apache.org>
Sent: Friday, November 08, 2002 3:56 PM
Subject: Re: log4j messages to String conversion?


> What do u need? The formatted event message? What do u
> need this for?
>
>
> --- Dirk <ho...@c-lab.de> wrote:
> > Hi,
> >
> > my question is, whether it is possible to get the
> > output string of a
> > method-call like this:  logger.debug("message").
> > I would like to send that String (which is perfectly
> > outputted on my
> > console) over an RMI connection.
> >
> >
> > Thanx a lot,
> > Dirk Hopmann
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: log4j messages to String conversion?

Posted by Ricardo Moral <ri...@yahoo.com>.
What do u need? The formatted event message? What do u
need this for? 


--- Dirk <ho...@c-lab.de> wrote:
> Hi,
> 
> my question is, whether it is possible to get the
> output string of a
> method-call like this:  logger.debug("message").
> I would like to send that String (which is perfectly
> outputted on my
> console) over an RMI connection.
> 
> 
> Thanx a lot,
> Dirk Hopmann
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


log4j messages to String conversion?

Posted by Dirk <ho...@c-lab.de>.
Hi,

my question is, whether it is possible to get the output string of a
method-call like this:  logger.debug("message").
I would like to send that String (which is perfectly outputted on my
console) over an RMI connection.


Thanx a lot,
Dirk Hopmann


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: org.apache.log4j.net.SocketAppender - Help with setLocationIn fo

Posted by Thomas Saxtoft <t....@sondagsavisen.dk>.
--- In Log4J@y..., Ceki Gülcü <ce...@q...> wrote:
> log4j location info behavior does NOT depend on the JDK, at least 
> not on 1.3 or 1.4.
That is true, but not very helpful. Gautam gave me the answer a few days ago:
http://groups.yahoo.com/group/Log4J/message/2970
Or at least what I think could be your problem.

Thomas Saxtoft



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>