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 Yair Ogen <ya...@bll.co.il> on 2004/11/24 14:50:09 UTC
smart file name
Hi,
I'de like to know if you can define a file name that appends to its name
the current time stamp (I don't mean rolling by date - the
DailyRollingAppender is not good for me).
What I need is that if I define a name like: kuku.log I want actually
kuku_2004-11-24-12:19.log or kuku.log_2004-11-24-12:19 or something of
the kind.
Is it possible?
Re: smart file name
Posted by shirish <sh...@india.infogain.com>.
No this is not the case,
In Log 4j you can set some variable (e.g filename ) and then set its value
later programmatically.
till the time those values are set , log4j is not configured .
Regards,
Shirish
----- Original Message -----
From: "James Stauffer" <st...@gmail.com>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Monday, March 07, 2005 11:40 PM
Subject: Re: smart file name
> It is added to log4j:configuration:
> <log4j:configuration debug="true"
> xmlns:log4j="http://jakarta.apache.org/log4j/">
>
> On Mon, 07 Mar 2005 11:23:20 -0600, Karan <ka...@resolution.com> wrote:
>> From my understanding of your email, I think you want to see log4j
>> errors, if any.
>> Put this line in the beginning of your log4j.xm/properties file:
>> log4j.debug=true
>> (I have never used the .xml file, so I'm not sure what you analogical
>> statement you would put in there).
>> This will run log4j on log4j :-)
>> All log4j debug messages will show up on the root logger, which I think
>> is stdout.
>>
>> HTHs,
>> Karan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: smart file name
Posted by James Stauffer <st...@gmail.com>.
It is added to log4j:configuration:
<log4j:configuration debug="true"
xmlns:log4j="http://jakarta.apache.org/log4j/">
On Mon, 07 Mar 2005 11:23:20 -0600, Karan <ka...@resolution.com> wrote:
> From my understanding of your email, I think you want to see log4j
> errors, if any.
> Put this line in the beginning of your log4j.xm/properties file:
> log4j.debug=true
> (I have never used the .xml file, so I'm not sure what you analogical
> statement you would put in there).
> This will run log4j on log4j :-)
> All log4j debug messages will show up on the root logger, which I think
> is stdout.
>
> HTHs,
> Karan
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: smart file name
Posted by Karan <ka...@resolution.com>.
From my understanding of your email, I think you want to see log4j
errors, if any.
Put this line in the beginning of your log4j.xm/properties file:
log4j.debug=true
(I have never used the .xml file, so I'm not sure what you analogical
statement you would put in there).
This will run log4j on log4j :-)
All log4j debug messages will show up on the root logger, which I think
is stdout.
HTHs,
Karan
shirish wrote:
> While setting the values for the variables defined in log4j.xml , if
> some
> error is encountered , where do we log this exception as the log4j has
> not
> been cpnfigured so far.?
>
> I am using System.err.println statements , can log4j be configured to log
> these statements
>
> Regards,
> Shirish
>
> ----- Original Message -----
> From: "Ceki G lc " <ce...@qos.ch>
> To: "Log4J Users List" <lo...@logging.apache.org>
> Sent: Thursday, November 25, 2004 2:30 PM
> Subject: RE: smart file name
>
>
> Yair,
>
> Are you calling PropertiesConfigurator, DOMConfigrator, JoranConfigrator
> yourself? If you are, you can fill in the value of the variable before
> invoking the configurator.
>
> To give you an idea, assume you use PropertiesConfigurator.
>
>
> Properties props = new Properties();
> FileInputStream istream = new
> FileInputStream("/your/config/file.properties");
> props.load(istream);
> istream.close()
>
> // set the value of "now" to a string formatted according to your
> // liking
> SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-ss");
> props.setProperty("now", sdf.format(new Date());
>
> // now configure log4j
> new PropertiesConfigurator().doConfigure(props,
> LogManager.getLogggingRepository());
>
>
> Your config file in properties format would look like
>
> log4j.rootLogger=debug, KUKU
> log4j.appender.KUKU=org.apache.log4j.FileAppender
> log4j.appender.KUKU.File=/wombat/kuku-${now}.log
> etc...
>
> I'd like to note that the choice of using "kuku" as a file name was
> yours,
> certainly not mine. :-)
>
> HTH,
>
> At 06:43 AM 11/25/2004, Yair Ogen wrote:
>
>> I've thiught about it, but when is try to put a variable on the file
>> name
>> it is ignored. Please note I'm looking for a static decleration in my
>> config file that will get a dynamic value every time the file is
>> created.
>> i.e. fileName="cat_{d}.log" or something like that.
>
>
> --
> Ceki G lc
>
> The complete log4j manual: http://qos.ch/eclm
> Professional log4j support: http://qos.ch/log4jSupport
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
> .
>
--
CM II
Resolution Systems Inc.
/-- never compromise. what if you compromise and lose? --/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: smart file name
Posted by shirish <sh...@india.infogain.com>.
While setting the values for the variables defined in log4j.xml , if some
error is encountered , where do we log this exception as the log4j has not
been cpnfigured so far.?
I am using System.err.println statements , can log4j be configured to log
these statements
Regards,
Shirish
----- Original Message -----
From: "Ceki Gülcü" <ce...@qos.ch>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Thursday, November 25, 2004 2:30 PM
Subject: RE: smart file name
Yair,
Are you calling PropertiesConfigurator, DOMConfigrator, JoranConfigrator
yourself? If you are, you can fill in the value of the variable before
invoking the configurator.
To give you an idea, assume you use PropertiesConfigurator.
Properties props = new Properties();
FileInputStream istream = new
FileInputStream("/your/config/file.properties");
props.load(istream);
istream.close()
// set the value of "now" to a string formatted according to your
// liking
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-ss");
props.setProperty("now", sdf.format(new Date());
// now configure log4j
new PropertiesConfigurator().doConfigure(props,
LogManager.getLogggingRepository());
Your config file in properties format would look like
log4j.rootLogger=debug, KUKU
log4j.appender.KUKU=org.apache.log4j.FileAppender
log4j.appender.KUKU.File=/wombat/kuku-${now}.log
etc...
I'd like to note that the choice of using "kuku" as a file name was yours,
certainly not mine. :-)
HTH,
At 06:43 AM 11/25/2004, Yair Ogen wrote:
>I've thiught about it, but when is try to put a variable on the file name
>it is ignored. Please note I'm looking for a static decleration in my
>config file that will get a dynamic value every time the file is created.
>i.e. fileName="cat_{d}.log" or something like that.
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: smart file name
Posted by Yair Ogen <ya...@bll.co.il>.
10x, that’s realy helpful. I
-----Original Message-----
From: Ceki Glc [mailto:ceki@qos.ch]
Sent: Thursday, November 25, 2004 11:01 AM
To: Log4J Users List
Subject: RE: smart file name
Yair,
Are you calling PropertiesConfigurator, DOMConfigrator, JoranConfigrator
yourself? If you are, you can fill in the value of the variable before
invoking the configurator.
To give you an idea, assume you use PropertiesConfigurator.
Properties props = new Properties();
FileInputStream istream = new
FileInputStream("/your/config/file.properties");
props.load(istream);
istream.close()
// set the value of "now" to a string formatted according to your
// liking
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-ss");
props.setProperty("now", sdf.format(new Date());
// now configure log4j
new PropertiesConfigurator().doConfigure(props,
LogManager.getLogggingRepository());
Your config file in properties format would look like
log4j.rootLogger=debug, KUKU
log4j.appender.KUKU=org.apache.log4j.FileAppender
log4j.appender.KUKU.File=/wombat/kuku-${now}.log
etc...
I'd like to note that the choice of using "kuku" as a file name was yours,
certainly not mine. :-)
HTH,
At 06:43 AM 11/25/2004, Yair Ogen wrote:
>I've thiught about it, but when is try to put a variable on the file name
>it is ignored. Please note I'm looking for a static decleration in my
>config file that will get a dynamic value every time the file is created.
>i.e. fileName="cat_{d}.log" or something like that.
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: smart file name
Posted by Ceki Gülcü <ce...@qos.ch>.
Yair,
Are you calling PropertiesConfigurator, DOMConfigrator, JoranConfigrator
yourself? If you are, you can fill in the value of the variable before
invoking the configurator.
To give you an idea, assume you use PropertiesConfigurator.
Properties props = new Properties();
FileInputStream istream = new
FileInputStream("/your/config/file.properties");
props.load(istream);
istream.close()
// set the value of "now" to a string formatted according to your
// liking
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-ss");
props.setProperty("now", sdf.format(new Date());
// now configure log4j
new PropertiesConfigurator().doConfigure(props,
LogManager.getLogggingRepository());
Your config file in properties format would look like
log4j.rootLogger=debug, KUKU
log4j.appender.KUKU=org.apache.log4j.FileAppender
log4j.appender.KUKU.File=/wombat/kuku-${now}.log
etc...
I'd like to note that the choice of using "kuku" as a file name was yours,
certainly not mine. :-)
HTH,
At 06:43 AM 11/25/2004, Yair Ogen wrote:
>I've thiught about it, but when is try to put a variable on the file name
>it is ignored. Please note I'm looking for a static decleration in my
>config file that will get a dynamic value every time the file is created.
>i.e. fileName="cat_{d}.log" or something like that.
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: smart file name
Posted by Yair Ogen <ya...@bll.co.il>.
I've thiught about it, but when is try to put a variable on the file name it is ignored. Please note I'm looking for a static decleration in my config file that will get a dynamic value every time the file is created. i.e. fileName="cat_{d}.log" or something like that.
-----Original Message-----
From: Ceki Glc [mailto:ceki@qos.ch]
Sent: Wednesday, November 24, 2004 6:01 PM
To: Log4J Users List
Subject: RE: smart file name
I see. Easy, just make use of variable substitution in your config files.
At 04:03 PM 11/24/2004, you wrote:
>The time stamp when the file is created.
>
>-----Original Message-----
>From: Ceki Glc [mailto:ceki@qos.ch]
>Sent: Wednesday, November 24, 2004 4:20 PM
>To: Log4J Users List
>Subject: Re: smart file name
>
>
>Hello Yair,
>
>The term *current* timestamp is somewhat vague. Current with respect to what?
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: smart file name
Posted by Ceki Gülcü <ce...@qos.ch>.
I see. Easy, just make use of variable substitution in your config files.
At 04:03 PM 11/24/2004, you wrote:
>The time stamp when the file is created.
>
>-----Original Message-----
>From: Ceki Gï¢lcï¢ [mailto:ceki@qos.ch]
>Sent: Wednesday, November 24, 2004 4:20 PM
>To: Log4J Users List
>Subject: Re: smart file name
>
>
>Hello Yair,
>
>The term *current* timestamp is somewhat vague. Current with respect to what?
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: smart file name
Posted by Yair Ogen <ya...@bll.co.il>.
This article is almost what I nedd, the only thing I'm short on is the ability to add minutes and seconds as well.
My business gole is to create a file name that has not only the date stamp but also the time stamp.
Maybe I should create my own Appender?
-----Original Message-----
From: Ted Gittinger [mailto:ted.gittinger@cpa.state.tx.us]
Sent: Wednesday, November 24, 2004 5:42 PM
To: Log4J Users List
Subject: Re: smart file name
See if this thread helps you out.
http://www.mail-archive.com/log4j-user@logging.apache.org/msg01793.html
Yair Ogen wrote:
> The time stamp when the file is created.
>
> -----Original Message-----
> From: Ceki Glc [mailto:ceki@qos.ch]
> Sent: Wednesday, November 24, 2004 4:20 PM
> To: Log4J Users List
> Subject: Re: smart file name
>
>
> Hello Yair,
>
> The term *current* timestamp is somewhat vague. Current with respect to what?
>
>
> At 02:50 PM 11/24/2004, Yair Ogen wrote:
>
>>Hi,
>>
>>I'de like to know if you can define a file name that appends to its name
>>the current time stamp (I don't mean rolling by date - the
>>DailyRollingAppender is not good for me).
>>
>>What I need is that if I define a name like: kuku.log I want actually
>>kuku_2004-11-24-12:19.log or kuku.log_2004-11-24-12:19 or something of
>>the kind.
>>
>>Is it possible?
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: smart file name
Posted by Ted Gittinger <te...@cpa.state.tx.us>.
See if this thread helps you out.
http://www.mail-archive.com/log4j-user@logging.apache.org/msg01793.html
Yair Ogen wrote:
> The time stamp when the file is created.
>
> -----Original Message-----
> From: Ceki Glc [mailto:ceki@qos.ch]
> Sent: Wednesday, November 24, 2004 4:20 PM
> To: Log4J Users List
> Subject: Re: smart file name
>
>
> Hello Yair,
>
> The term *current* timestamp is somewhat vague. Current with respect to what?
>
>
> At 02:50 PM 11/24/2004, Yair Ogen wrote:
>
>>Hi,
>>
>>I'de like to know if you can define a file name that appends to its name
>>the current time stamp (I don't mean rolling by date - the
>>DailyRollingAppender is not good for me).
>>
>>What I need is that if I define a name like: kuku.log I want actually
>>kuku_2004-11-24-12:19.log or kuku.log_2004-11-24-12:19 or something of
>>the kind.
>>
>>Is it possible?
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: smart file name
Posted by Yair Ogen <ya...@bll.co.il>.
The time stamp when the file is created.
-----Original Message-----
From: Ceki Glc [mailto:ceki@qos.ch]
Sent: Wednesday, November 24, 2004 4:20 PM
To: Log4J Users List
Subject: Re: smart file name
Hello Yair,
The term *current* timestamp is somewhat vague. Current with respect to what?
At 02:50 PM 11/24/2004, Yair Ogen wrote:
>
>Hi,
>
>I'de like to know if you can define a file name that appends to its name
>the current time stamp (I don't mean rolling by date - the
>DailyRollingAppender is not good for me).
>
>What I need is that if I define a name like: kuku.log I want actually
>kuku_2004-11-24-12:19.log or kuku.log_2004-11-24-12:19 or something of
>the kind.
>
>Is it possible?
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: smart file name
Posted by Ceki Gülcü <ce...@qos.ch>.
Hello Yair,
The term *current* timestamp is somewhat vague. Current with respect to what?
At 02:50 PM 11/24/2004, Yair Ogen wrote:
>
>Hi,
>
>I'de like to know if you can define a file name that appends to its name
>the current time stamp (I don't mean rolling by date - the
>DailyRollingAppender is not good for me).
>
>What I need is that if I define a name like: kuku.log I want actually
>kuku_2004-11-24-12:19.log or kuku.log_2004-11-24-12:19 or something of
>the kind.
>
>Is it possible?
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org