ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wannheden, Knut" <K...@paranor.ch>
Subject RE: configuring log4j for task
Date Tue, 23 Apr 2002 15:25:58 GMT
What I've ended up doing was to include a log4j.properties file inside the
jar for my classes.  This file will get loaded unless the user has defined
the system property "log4j.configuration".  Btw, how can a property be
defined as system property (i.e. returned when calling System.getProperty())
from command line when invoking Ant?  The only way I've found is to set the
according environment variable, but that isn't really useful.  The '-D'
option only sets a property (not a system property) IIRC.

Additionally I added a "logfile" attribute to the tasks, which makes log4j
log with a default appender and layout to a specified file.

Is this a viable solution?

--
knut

> -----Original Message-----
> From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
> Sent: Dienstag, 23. April 2002 15:04
> To: Ant Developers List
> Subject: Re: configuring log4j for task
> 
> 
> XDoclet makes extensive use of Log4j during its operation, so 
> I'd check in
> their codebase to see how they are doing it.
> 
> Also, there is a Log4jListener in Ant's codebase, but it does 
> not pre-define
> any configuration, only uses the standard way that Log4j 
> configures itself.
> 
>     Erik
> 
> 
> ----- Original Message -----
> From: "Wannheden, Knut" <Knut@paranor.ch>
> To: <ant-dev@jakarta.apache.org>
> Sent: Tuesday, April 23, 2002 5:58 AM
> Subject: configuring log4j for task
> 
> 
> > Hi,
> >
> > I have written a high level Java wrapper for the ClearCase 
> SCM system.  I
> > extensively used the log4j logging library to trace all the 
> actions in the
> > wrapper.  So in case anything goes wrong, I will still know 
> what changes
> > have (or haven't) been made.  Implementing appropriate 
> rollback commands
> > would of course be the way to go ;)
> >
> > I would now like to create Ant tasks for the ClearCase commands.
> (Possibly
> > I'd do this using xdoclet, as the ClearCase commands all 
> pretty much have
> > the same interface.)  But I am unsure what to do about the 
> log4j log.
> > Normally when using log4j the user should define the 
> "log4j.configuration"
> > system property.  I would still want to encourage this 
> usage pattern, but
> > I'd also like to have some kind of default configuration; let's say
> > everything with priority of at least INFO should be logged 
> to the console
> or
> > a default file.  This would be effective if the user didn't set the
> > log4j.configuration property.
> >
> > Furthermore it would also be nice if it were possible to 
> specify the log4j
> > configuration as attributes or nested elements of the 
> ClearCase tasks.
> >
> > Does anyone have a good suggestion on how to integrate the log4j
> > configuration into an Ant task?  Or has it been done with 
> other tasks
> > already?
> >
> > Thanks,
> >
> > Knut Wannheden.
> >
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message