logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Deboy <scott.de...@gmail.com>
Subject Re: log4j----Edit the event received
Date Fri, 16 Sep 2011 17:48:27 GMT
Here is an example from the tests in log4j:

http://svn.apache.org/viewvc/logging/log4j/companions/receivers/trunk/src/test/resources/org/apache/log4j/rewrite/property.xml?view=markup&pathrev=564831

     <appender name="F1" class="org.apache.log4j.FileAppender">
       <param name="file" value="temp"/>
       <param name="append" value="false"/>
       <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%p %c - p1:%X{p1} p2:%X{p2}
%m%n"/>
       </layout>
     </appender>


     <appender name="A1" class="org.apache.log4j.rewrite.RewriteAppender">
       <appender-ref ref="F1"/>
       <rewritePolicy
class="org.apache.log4j.rewrite.PropertyRewritePolicy">
         <param name="properties" value="p1=Hello,p2=World,x1=3.1415"/>
       </rewritePolicy>
     </appender>

     <root>
       <level value ="debug" />
       <appender-ref ref="A1" />
     </root>

On Fri, Sep 16, 2011 at 8:49 AM, Konduru, Geetha
<Geetha_Konduru@medco.com>wrote:

> Would any one please give an example of xml configuration file with
> Rewrite Appender.
>
> Thank U,
> Vgss
>
> -----Original Message-----
> From: Konduru, Geetha [mailto:Geetha_Konduru@medco.com]
> Sent: Thursday, September 15, 2011 1:57 PM
> To: Log4J Users List
> Subject: RE: log4j----Edit the event received
>
> log4j: Trying to find [server2Rewritelog4j.xml] using context
> classloader sun.misc.Launcher$AppClassLoader@601bb1.
> log4j: Using URL
> [file:/C:/EclipseWorkSpace/GemfireTest/bin/server2Rewritelog4j.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:WARN Continuable parsing error 19 and column 97
> log4j:WARN Element type "rewritePolicy" must be declared.
> log4j:WARN Continuable parsing error 22 and column 12
> log4j:WARN The content of element type "appender" must match
> "(errorHandler?,param*,rollingPolicy?,triggeringPolicy?,connectionSource
> ?,layout?,filter*,appender-ref*)".
> log4j: debug attribute= "null".
> log4j: Ignoring debug attribute.
> log4j: reset attribute= "false".
> log4j: Threshold ="null".
> log4j: Level value for root is  [debug].
> log4j: root level set to DEBUG
> log4j: Class name: [org.apache.log4j.ConsoleAppender]
> log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
> log4j: Setting property [conversionPattern] to [[%d{ISO8601} %t %c]
> %m%n].
> log4j: Adding appender named [CA] to category [root]
>
> -----Original Message-----
> From: Scott Deboy [mailto:scott.deboy@gmail.com]
> Sent: Thursday, September 15, 2011 1:54 PM
> To: Log4J Users List
> Subject: Re: log4j----Edit the event received
>
> There is a DTD for core elements but alternate elements can be added
> (like
> rewritepolicy)...you won't find rewritepolicy in the DTD.
>
> Can you add -Dlog4j.debug=true to your appender-side java command, and
> paste
> the output?
>
> Thanks
>
> Scott
>
> On Thu, Sep 15, 2011 at 10:38 AM, Konduru, Geetha
> <Geetha_Konduru@medco.com>wrote:
>
> > Where can I find XMLschema file for log4j XML configuration file????
> >
> >
> > Thank U,
> > VGSS
> >
> > -----Original Message-----
> > From: Scott Deboy [mailto:scott.deboy@gmail.com]
> > Sent: Wednesday, September 14, 2011 4:51 PM
> > To: Log4J Users List
> > Subject: Re: log4j----Edit the event received
> >
> > Missed the end param on the nested properties param...not sure about
> > case of
> > RewritePolicy node name..may be rewritePolicy.
> >
> > <appender name="rewrite"
> > class="org.apache.log4j.rewrite.RewriteAppender">
> >    <appender name="socket"
> class="org.apache.log4j.net.SocketAppender">
> >      <param name="Port" value="12346"/>
> >      <param name="RemoteHost" value="localhost"/>
> >      <param name="Application" value="app1"/>
> >      <param name="ReconnectionDelay" value="60000"/>
> >      <param name="Threshold" value="ALL"/>
> >    </appender>
> >    <RewritePolicy name="propertyPolicy"
> > class="org.apache.log4j.rewrite.PropertyRewritePolicy">
> >        <param name="properties"
> >
> value="somepropertyname1=somepropertyvalue1,somepropertyname2=someproper
> > tyvalue2"/>
> >    </RewritePolicy>
> > </appender>
> >
> >
> > On Wed, Sep 14, 2011 at 1:48 PM, Konduru, Geetha
> > <Geetha_Konduru@medco.com>wrote:
> >
> > > Thank U...
> > >
> > > -----Original Message-----
> > > From: Scott Deboy [mailto:scott.deboy@gmail.com]
> > > Sent: Wednesday, September 14, 2011 4:31 PM
> > > To: Log4J Users List
> > > Subject: Re: log4j----Edit the event received
> > >
> > > remoteSourceInfo contains the connected port:
> > >
> > > hostName = socket.getInetAddress().getHostName();
> > > remoteInfo = hostName + ":" + socket.getPort();
> > >
> > > On Wed, Sep 14, 2011 at 1:23 PM, Konduru, Geetha
> > > <Geetha_Konduru@medco.com>wrote:
> > >
> > > > yes, I got them
> > > >
> > > > how are "hostname" and " log4j.remoteSourceInfo"  different from
> > each
> > > > other....
> > > >
> > > > thank U
> > > > VGSS
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Scott Deboy [mailto:scott.deboy@gmail.com]
> > > > Sent: Wednesday, September 14, 2011 4:15 PM
> > > > To: Log4J Users List
> > > > Subject: Re: log4j----Edit the event received
> > > >
> > > > The SocketReceiver adds two properties to each event:
> > > > hostname
> > > > log4j.remoteSourceInfo
> > > >
> > > > With the developer snapshot of Chainsaw you should see those as
> > > > individual
> > > > columns in the table.  If they aren't displayed by default you can
> > > > enable
> > > > them via the tab preferences menu (select Columns).
> > > >
> > > > Scott
> > > >
> > > > On Wed, Sep 14, 2011 at 12:38 PM, Konduru, Geetha
> > > > <Geetha_Konduru@medco.com>wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > >
> > > > >
> > > > >  What I am looking for is, every event received by
> SocketAppender,
> > > > even
> > > > > before it send to remote machine, it must append  to the
> event(on
> > > > which
> > > > > log4j is running).
> > > > >
> > > > >
> > > > >
> > > > >  Can any one please tell me a solution for this.
> > > > >
> > > > >
> > > > >
> > > > > Example: if application(running on machine HOSTNAME) logs
> message
> > "I
> > > > am
> > > > > a Logging event", than SOCKET APPENDER must send following to
> > REMOTE
> > > > > machine(or SOCKET RECEIVER on Remote machine should receive
> > > following
> > > > as
> > > > > log message).
> > > > >
> > > > >
> > > > >
> > > > > "HOSTNAME:I am a Logging event"
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Thank U,
> > > > >
> > > > > VGSS
> > > > >
> > > > >
> > >
> **********************************************************************
> > > > > This e-mail message and any attachments contain confidential
> > > > information
> > > > > from Medco. If you are not the intended recipient, you are
> hereby
> > > > notified
> > > > > that disclosure, printing, copying, distribution, or the taking
> of
> > > any
> > > > > action in reliance on the contents of this electronic
> information
> > is
> > > > > strictly prohibited. If you have received this e-mail message in
> > > > error,
> > > > > please immediately notify the sender by reply message and then
> > > delete
> > > > the
> > > > > electronic message and any attachments.
> > > > >
> > > >
> > > >
> > **********************************************************************
> > > > This e-mail message and any attachments contain confidential
> > > information
> > > > from Medco. If you are not the intended recipient, you are hereby
> > > notified
> > > > that disclosure, printing, copying, distribution, or the taking of
> > any
> > > > action in reliance on the contents of this electronic information
> is
> > > > strictly prohibited. If you have received this e-mail message in
> > > error,
> > > > please immediately notify the sender by reply message and then
> > delete
> > > the
> > > > electronic message and any attachments.
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > > For additional commands, e-mail:
> log4j-user-help@logging.apache.org
> > > >
> > > >
> > >
> > >
> **********************************************************************
> > > This e-mail message and any attachments contain confidential
> > information
> > > from Medco. If you are not the intended recipient, you are hereby
> > notified
> > > that disclosure, printing, copying, distribution, or the taking of
> any
> > > action in reliance on the contents of this electronic information is
> > > strictly prohibited. If you have received this e-mail message in
> > error,
> > > please immediately notify the sender by reply message and then
> delete
> > the
> > > electronic message and any attachments.
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> >
> > **********************************************************************
> > This e-mail message and any attachments contain confidential
> information
> > from Medco. If you are not the intended recipient, you are hereby
> notified
> > that disclosure, printing, copying, distribution, or the taking of any
> > action in reliance on the contents of this electronic information is
> > strictly prohibited. If you have received this e-mail message in
> error,
> > please immediately notify the sender by reply message and then delete
> the
> > electronic message and any attachments.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
> **********************************************************************
> This e-mail message and any attachments contain confidential information
> from Medco. If you are not the intended recipient, you are hereby
> notified that disclosure, printing, copying, distribution, or the taking
> of any action in reliance on the contents of this electronic information
> is strictly prohibited. If you have received this e-mail message in
> error, please immediately notify the sender by reply message and then
> delete the electronic message and any attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
> **********************************************************************
> This e-mail message and any attachments contain confidential information
> from Medco. If you are not the intended recipient, you are hereby notified
> that disclosure, printing, copying, distribution, or the taking of any
> action in reliance on the contents of this electronic information is
> strictly prohibited. If you have received this e-mail message in error,
> please immediately notify the sender by reply message and then delete the
> electronic message and any attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

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