To do that using a config file, have your program call
System.setProperty("pid", pid) before log4j is configured and use the
following in your config:
    <param name="File"   value="${pid}workshop.log" />

On 3/29/06, Silvana Lima <[EMAIL PROTECTED]> wrote:
> Sorry but I didnt understand what you meant.
>
> I found this tutorial
> http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/log4j/log4j.html#LOG4J-Basics-Layout
>
>
> I am trying to implement with FileAppender
>
>         org.apache.log4j.Logger myLog =
> org.apache.log4j.Logger.getLogger(classeName);
>         FileAppender appender = null;
>         try {
>            appender = new FileAppender(new PatternLayout(), ClassName +
> "_"+ context.getInstanceId());
>         } catch(Exception e) {}
>
>         myLog.addAppender(appender);
>         myLog.setLevel((Level) Level.INFO);
>
>         myLog.info("Test Log");
>
> But thanks very much for the quick answer.
>
> >>> [EMAIL PROTECTED] 29/03/2006 16:06 >>>
> If you can set the desired log name as a system property then it should
> work.
>
> On 3/29/06, Silvana Lima <[EMAIL PROTECTED]> wrote:
> > Hello to all,
> >
> > I am in a project using BEA - Workshop Integration in a Windows
> plataform.
> > I am trying to figure out if it is possible to create a log file
> dynamically just when a java processe starts with the Process ID as part
> of the name of the log file.
> >
> > In the configuration file for Log4J it is used this configuration
> >
> >   <appender name="APPLOGFILE"
> class="org.apache.log4j.RollingFileAppender">
> >     <param name="File"   value="workshop.log" />
> >     <param name="Append" value="true" />
> >     <param name="MaxFileSize" value="3000KB" />
> >     <layout class="org.apache.log4j.PatternLayout">
> >       <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1}:
> %m%n"/>
> >     </layout>
> >   </appender>
> >
> >   <category name="wlw">
> >     <priority value="info" />
> >     <appender-ref ref="APPLOGFILE" />
> >   </category>
> >
> > ************************
> > I created this
> >
> >   <appender name="MYAPPLOGFILE"
> class="org.apache.log4j.RollingFileAppender">
> >     <param name="File"
> value="processes.VantiveInsertAddressSync.log" />
> >     <param name="Append" value="true" />
> >     <param name="MaxFileSize" value="3000KB" />
> >     <layout class="org.apache.log4j.PatternLayout">
> >       <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1}:
> %m%n"/>
> >     </layout>
> >   </appender>
> >
> >   <category
> name="xxx.eai.processes.vantive.manterendereco.VantiveInsertAddressSync">
> >     <priority value="info" />
> >     <appender-ref ref="MYAPPLOGFILE" />
> >   </category>
> >
> >
> > This works to log the VantiveInsertAddressSync process itself. But
> the client wants a different log for each instance of the process.
> > Is there a way to do this with log4J API?
> >
> > Thanks for any help
> > Please reply to [EMAIL PROTECTED]
> >
> > Silvana.
> >
> >
> >
> >
> --------------------------------------------------------------------------------------------------------
> > O conteúdo desta mensagem e de seus anexos é de uso restrito e
> confidencial, sendo o seu sigilo protegido por lei. Estas informações
> não podem ser divulgadas sem prévia autorização escrita. Se você não é
> o destinatário desta mensagem, ou o responsável pela sua entrega,
> apague-a imediatamente e avise ao remetente, respondendo a esta
> mensagem. Alertamos que esta mensagem transitou por rede pública de
> comunicação, estando, portanto, sujeita aos riscos inerentes a essa
> forma de comunicação. A QUALITY SOFTWARE não se responsabiliza por
> conclusões, opiniões, ou outras informações nesta mensagem que não
> tenham sido emitidas por seus integrantes.
> >
> >
> > This e-mail and any attachments are confidential and may also be
> privileged. If you are not the named recipient, please notify the sender
> immediately and do not disclose the contents to any other person, use it
> for any purpose, or store or copy the information. In the event of any
> technical difficulty with this email, please contact the sender. QUALITY
> SOFTWARE is not responsible for conclusion, opinions or any kind of
> information in this message that doesn't come from our personnel.
> >
> --------------------------------------------------------------------------------------------------------
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> --------------------------------------------------------------------------------------------------------
> O conteúdo desta mensagem e de seus anexos é de uso restrito e confidencial, 
> sendo o seu sigilo protegido por lei. Estas informações não podem ser 
> divulgadas sem prévia autorização escrita. Se você não é o destinatário desta 
> mensagem, ou o responsável pela sua entrega, apague-a imediatamente e avise 
> ao remetente, respondendo a esta mensagem. Alertamos que esta mensagem 
> transitou por rede pública de comunicação, estando, portanto, sujeita aos 
> riscos inerentes a essa forma de comunicação. A QUALITY SOFTWARE não se 
> responsabiliza por conclusões, opiniões, ou outras informações nesta mensagem 
> que não tenham sido emitidas por seus integrantes.
>
>
> This e-mail and any attachments are confidential and may also be privileged. 
> If you are not the named recipient, please notify the sender immediately and 
> do not disclose the contents to any other person, use it for any purpose, or 
> store or copy the information. In the event of any technical difficulty with 
> this email, please contact the sender. QUALITY SOFTWARE is not responsible 
> for conclusion, opinions or any kind of information in this message that 
> doesn't come from our personnel.
> --------------------------------------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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

Reply via email to