Jacob Kjome | 1 May 08:09 2008

Re: Ant, log4j: Defining log file path with ant properties


Sure, are you wanting logs for unit tests or something?  Then just define a system
property to set inside the junit task....

<junit ....>
<sysproperty key="log.file"
             value="${dir}/log/build.log"/>
</junit>

Jake

Friedbert Widmann wrote:
> Is it possible, to overwrite the path of the logfile with properties set within
> the project build file.
> 
> Example: I want to define a target like the following:
> 	<target name="init">
> 		<mkdir dir="${dir}/log" />
> 		<property key="log.file" value="${dir}/log/build.log" />
> 		<magic> reopen log4j logfiles </magic>
> 	</target>
> It defines a project specific directory for the logfiles and should overwrite
> the definitions in log4j.properties.
> The log4j.properties should look like:
> 	log4j.rootLogger=INFO, LogFile
> 	log4j.appender.LogFile.File=${log.file}
> 
> Mit freundlichen Grüßen, / With best regards,
> Friedbert Widmann
> 
(Continue reading)

Petr Vorel | 2 May 14:26 2008
Picon

logging to syslog (with SyslogAppender) and NOT to console (stdout)

Hello,

I'm trying to configure logging to syslog (with SyslogAppender) and NOT to console (stdout). Logging to
syslog is fine, but I still get messages to stdout as well (for some reason I don't want to redirect it >
/dev/null )

Does anyone have any idea what could cause logging to stdout as well?

I'm running command (with -Dlog4j.debug - in case it helps to somebody to find something from it).

Thanks a lot for advise.

Pev

java -Dorg.quartz.properties=etc/quartz.properties -Dlog4j.debug
-Dlog4j.configuration=etc/log4j.xml -cp .:lib/*:lib/quartz/* pser.Pser

log4j: Trying to find [etc/log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader <at> 7d772e.
log4j: Using URL [file:/home/petr/workspace/pkds/etc/log4j.xml] for automatic log4j configuration.
log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= "null".
log4j: Ignoring debug attribute.
log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.quartz] additivity to [true].
log4j: Level value for org.quartz is [debug].
(Continue reading)

Jacob Kjome | 2 May 20:53 2008

Re: logging to syslog (with SyslogAppender) and NOT to console (stdout)

On Fri, 02 May 2008 14:26:58 +0200 (CEST)
  Petr Vorel <pevik <at> seznam.cz> wrote:
> Hello,
> 
> I'm trying to configure logging to syslog (with SyslogAppender) and NOT to 
>console (stdout). Logging to syslog is fine, but I still get messages to 
>stdout as well (for some reason I don't want to redirect it > /dev/null )
> 
> Does anyone have any idea what could cause logging to stdout as well?

Is something else manually configuring Log4j?  A rogue library?  Configuration 
is cumulative, so another call to configure() could very well be adding a 
ConsoleAppender to the root logger.

Jake

> 
> I'm running command (with -Dlog4j.debug - in case it helps to somebody to 
>find something from it).
> 
> Thanks a lot for advise.
> 
> Pev
> 
> 
> 
> java -Dorg.quartz.properties=etc/quartz.properties -Dlog4j.debug 
>-Dlog4j.configuration=etc/log4j.xml -cp .:lib/*:lib/quartz/* pser.Pser
> 
> log4j: Trying to find [etc/log4j.xml] using context classloader 
(Continue reading)

Petr Vorel | 2 May 21:51 2008
Picon

Re: logging to syslog (with SyslogAppender) and NOT to console (stdout)

Hello Jake,

thanks for a reply - it helped me to solve the problem.

I'm using for configuration BasicConfigurator.configure()

grep -r "BasicConfigurator.configure()" * |grep -v svn
pser/Pser.java:		BasicConfigurator.configure();
pcli/Pcli.java:		BasicConfigurator.configure();

so it's just in pser.Pser and pcli.Pcli classes.

These classes have their own shell scripts which start them and in both is configuration pointing to log4j.xml

I commented both of them out, and it worked. I didn't know that I don't have to use
BasicConfigurator.configure() when I have log4j config file.

Once again, thanks a lot.
Petr

> On Fri, 02 May 2008 14:26:58 +0200 (CEST)
>   Petr Vorel <pevik <at> seznam.cz> wrote:
> > Hello,
> > 
> > I'm trying to configure logging to syslog (with SyslogAppender) and NOT to 
> >console (stdout). Logging to syslog is fine, but I still get messages to 
> >stdout as well (for some reason I don't want to redirect it > /dev/null )
> > 
> > Does anyone have any idea what could cause logging to stdout as well?
> 
(Continue reading)

Curt Arnold | 2 May 22:31 2008
Picon

Re: logging to syslog (with SyslogAppender) and NOT to console (stdout)


On May 2, 2008, at 7:26 AM, Petr Vorel wrote:

> Hello,
>
> I'm trying to configure logging to syslog (with SyslogAppender) and  
> NOT to console (stdout). Logging to syslog is fine, but I still get  
> messages to stdout as well (for some reason I don't want to redirect  
> it > /dev/null )
>
> Does anyone have any idea what could cause logging to stdout as well?
>
> I'm running command (with -Dlog4j.debug - in case it helps to  
> somebody to find something from it).
>
> Thanks a lot for advise.
>
> Pev
>
> My log4j configuration ---------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>
>  <!-- syslog -->
>  <appender name="syslog" class="org.apache.log4j.net.SyslogAppender">
>    <param name="SyslogHost" value="localhost"/>
>    <param name="Facility" value="LOCAL0"/>
>    <param name="Threshold" value="INFO"/>
(Continue reading)

Petr Vorel | 3 May 22:19 2008
Picon

Re: logging to syslog (with SyslogAppender) and NOT to console (stdout)


> 
> On May 2, 2008, at 7:26 AM, Petr Vorel wrote:
> 
> > Hello,
> >
> > I'm trying to configure logging to syslog (with SyslogAppender) and  
> > NOT to console (stdout). Logging to syslog is fine, but I still get  
> > messages to stdout as well (for some reason I don't want to redirect  
> > it > /dev/null )
> >
> > Does anyone have any idea what could cause logging to stdout as well?
> >
> > I'm running command (with -Dlog4j.debug - in case it helps to  
> > somebody to find something from it).
> >
> > Thanks a lot for advise.
> >
> > Pev
> >
> > My log4j configuration ---------------------------------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> >
> > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
> >
> >  <!-- syslog -->
> >  <appender name="syslog" class="org.apache.log4j.net.SyslogAppender">
> >    <param name="SyslogHost" value="localhost"/>
> >    <param name="Facility" value="LOCAL0"/>
(Continue reading)

Cerizza, Giordano | 5 May 03:30 2008
Picon

loading more receivers

Hi,
I have five different independent applications that send error messages to the same Chainsaw into one
receiver and
everything works fine. In general, I have a xml file, that loads when launching Chainsaw, that allows me to
have all 
the parameters for the receiver instantiated at the start up. The code for the receiver looks like:

   <plugin name="logFileReceiver" class="org.apache.log4j.net.XMLSocketReceiver">
     <param name="name" value="pixelFED" />
     <param name="port" value="1970" />
     <param name="threshold" value="INFO" />
   </plugin>

Now I would like to have for each application its own receiver on the same port.
If I'd like to have more receivers on the same port but with different name, is there a way I can implement this via
xml config file instead of my hand? I tried by hand and it works but I would like to automatize this process.

Thanks a lot
ciao
giordano
friedbert.widmann | 5 May 09:33 2008

Antwort: Re: Ant, log4j: Defining log file path with ant properties

Thank you, Jake,

but your suggestion is not what I am looking for.

Jacob Kjome <hoju <at> visi.com> schrieb am 01.05.2008 08:09:46:
> Sure, are you wanting logs for unit tests or something?  Then just
> define a system property to set inside the junit task....
> <junit ....>
> <sysproperty key="log.file"
>              value="${dir}/log/build.log"/>
> </junit>

The element sysproperty is usable only in the junit task. I am looking for
a solution, which works for any tasks.
My scenario: I have to implement an installation job and try to use ant. So
the different installation steps are done by ant targets. The first step is
to copy the whole directory structure from the installation medium (CD/DVD)
to hard disk. During this first step the logging should go to a
site-specific directory on the hard disk (e.g. D:/appl/log/build.log). The
subsequent steps are called from the site-specific directory
(cwd==D:/appl), so the log file can be specified relative (e.g.
./log/build.log).
I tried to specify the log directory with a property in log4j.properties
   dir=.
   log4j.appender.LogFile.File=${dir}/log/build.log
and to override this directory by a property definition within an ant
target.
But it doesn´t work. I believe, the file log4j.properties is read and
interpreted before the ant targets are executed. Therefore the overwritten
property has never priority before the default value in log4j.properties.
(Continue reading)

Jacob Kjome | 5 May 17:02 2008

Re: Antwort: Re: Ant, log4j: Defining log file path with ant properties

ant -Ddir=/path/to/dir someAntTarget

Jake

On Mon, 5 May 2008 09:33:59 +0200
  friedbert.widmann <at> hoerbiger.com wrote:
> Thank you, Jake,
> 
> but your suggestion is not what I am looking for.
> 
> Jacob Kjome <hoju <at> visi.com> schrieb am 01.05.2008 08:09:46:
>> Sure, are you wanting logs for unit tests or something?  Then just
>> define a system property to set inside the junit task....
>> <junit ....>
>> <sysproperty key="log.file"
>>              value="${dir}/log/build.log"/>
>> </junit>
> 
> The element sysproperty is usable only in the junit task. I am looking for
> a solution, which works for any tasks.
> My scenario: I have to implement an installation job and try to use ant. So
> the different installation steps are done by ant targets. The first step is
> to copy the whole directory structure from the installation medium (CD/DVD)
> to hard disk. During this first step the logging should go to a
> site-specific directory on the hard disk (e.g. D:/appl/log/build.log). The
> subsequent steps are called from the site-specific directory
> (cwd==D:/appl), so the log file can be specified relative (e.g.
> ./log/build.log).
> I tried to specify the log directory with a property in log4j.properties
>   dir=.
(Continue reading)

Scott Deboy | 5 May 17:59 2008

RE: loading more receivers

The latest versions of the network-based appenders support an
'application' property - if each of your applications define the
application property, they'll show up in their own tab - you should be
able to continue to use the receiver config listed below.

Does that help?

Scott

-----Original Message-----
From: Cerizza, Giordano [mailto:gcerizza <at> utk.edu] 
Sent: Sunday, May 04, 2008 6:31 PM
To: log4j-user <at> logging.apache.org
Subject: loading more receivers

Hi,
I have five different independent applications that send error messages
to the same Chainsaw into one receiver and
everything works fine. In general, I have a xml file, that loads when
launching Chainsaw, that allows me to have all 
the parameters for the receiver instantiated at the start up. The code
for the receiver looks like:

   <plugin name="logFileReceiver"
class="org.apache.log4j.net.XMLSocketReceiver">
     <param name="name" value="pixelFED" />
     <param name="port" value="1970" />
     <param name="threshold" value="INFO" />
   </plugin>

(Continue reading)


Gmane