logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Flushing?
Date Thu, 25 Aug 2005 11:05:12 GMT
Charles,

Using your RollingRouterOutputAppender config, my NoIP-router-output.txt
does not have any newlines between the messages.
I did have to replace the \r\n in the header and footer with &#13;&#10;
as we now only support the XML encoding scheme.

Nicko

> -----Original Message-----
> From: Charles Johnson [mailto:cj@cehjohnson.uklinux.net] 
> Sent: 24 August 2005 21:04
> To: Log4NET User
> Subject: Re: Flushing?
> 
> 
> 
> Nicko Cadell wrote:
> 
> >If you don't want a newline at the end of your message then 
> remove the 
> >%n from your PatternLayout.
> >
> >Nicko
> >
> >  
> >
> >>-----Original Message-----
> >>From: Charles Johnson [mailto:cj@cehjohnson.uklinux.net]
> >>Sent: 24 August 2005 13:05
> >>To: Log4NET User
> >>Subject: Re: Flushing?
> >>
> >>Thank you Nicko. This is my config file. Actually the question has 
> >>kind of moved on now. What I really want to know is if it's 
> possible 
> >>to just print the log message only, as opposed to println the log 
> >>message? I still may need some line breaks alone for headers and 
> >>footers though. TIA
> >>
> >>Charles
> >>
> >>
> >><?xml version="1.0" encoding="utf-8" ?>
> >><!--
> >>        .NET application configuration file    
> >>        This file must have the exact same name as your application 
> >>with .config appended to it.
> >>       
> >>        For example if your application is ConsoleApp.exe then the 
> >>config file must be ConsoleApp.exe.config.
> >>        It must also be in the same directory as the application.
> >>    -->
> >><configuration>
> >>    <!-- Register a section handler for the log4net section -->
> >>    <configSections>
> >>        <section name="log4net"
> >>type="System.Configuration.IgnoreSectionHandler" />
> >>    </configSections>
> >>    <appSettings>
> >>        <!-- To enable internal log4net logging specify the 
> following 
> >>appSettings key -->
> >>        <!-- <add key="log4net.Internal.Debug" value="true"/>
> >>--></appSettings>
> >>    <!-- This section contains the log4net configuration 
> settings -->
> >>    <log4net>
> >>        <!-- Define some output appenders -->
> >>        <appender name="RollingLogFileAppender"
> >>type="log4net.Appender.RollingFileAppender">
> >>            <param name="File" value="NoIP-log.txt" />
> >>            <param name="AppendToFile" value="true" />
> >>            <param name="MaxSizeRollBackups" value="0" />
> >>            <param name="MaximumFileSize" value="100KB" />
> >>            <param name="RollingStyle" value="Size" />
> >>            <param name="StaticLogFileName" value="true" />
> >>            <layout type="log4net.Layout.PatternLayout">
> >>                <param name="Header" value="[Header]\r\n" />
> >>                <param name="Footer" value="[Footer]\r\n" />
> >>                <param name="ConversionPattern" value="%d 
> [%t] %-5p %c 
> >>[%x] - %m%n" />
> >>            </layout>
> >>        </appender>
> >>        <!-- This is purely for viewing the actual router 
> output (its
> >>configuration) -->
> >>        <appender name="RollingRouterOutputAppender"
> >>type="log4net.Appender.RollingFileAppender">
> >>            <param name="File" value="NoIP-router-output.txt" />
> >>            <param name="AppendToFile" value="true" />
> >>            <param name="MaxSizeRollBackups" value="0" />
> >>            <param name="MaximumFileSize" value="100KB" />
> >>            <param name="RollingStyle" value="Size" />
> >>            <param name="StaticLogFileName" value="true" />
> >>            <layout type="log4net.Layout.PatternLayout">
> >>                <param name="Header" value="\r\n" />
> >>                <param name="Footer" value="\r\n\r\n" />
> >>                <param name="ConversionPattern" value="%m" />
> >>            </layout>
> >>        </appender>
> >>        <appender name="ConsoleAppender"
> >>type="log4net.Appender.ConsoleAppender">
> >>            <layout type="log4net.Layout.PatternLayout">
> >>                <param name="ConversionPattern" value="%d 
> [%t] %-5p %c 
> >>[%x] &lt;%X{auth}&gt; - %m%n" />
> >>            </layout>
> >>        </appender>
> >>        <!-- Setup the root category, add the appenders and set the 
> >>default level -->
> >>        <root>
> >>            <level value="ERROR" />
> >>            <appender-ref ref="RollingLogFileAppender" />
> >>            <!--<appender-ref ref="ConsoleAppender" />-->
> >>        </root>
> >>        <logger name="SaveIp.TelnetClient">
> >>            <level value="INFO" />
> >>            <!--<appender-ref ref="ConsoleAppender" />-->
> >>            <!--<additivity value="false" />-->
> >>        </logger>
> >>        <logger name="SaveIp.NoIpUpload">
> >>            <level value="DEBUG" />
> >>            <!--<appender-ref ref="ConsoleAppender" />-->
> >>            <!--<additivity value="false" />-->
> >>        </logger>
> >>        <logger name="SaveIp.RouterOutputLogger">
> >>            <level value="INFO" />
> >>            <appender-ref ref="RollingRouterOutputAppender" />
> >>            <additivity value="false" />
> >>        </logger>
> >>    </log4net>
> >>    <!-- Router address -->
> >>    <appSettings>
> >>        <add key="TestRouterAddress" value="localhost" />
> >>        <add key="RouterAddress" value="192.168.7.1" />
> >>        <add key="RouterPassword" value="ar601" />
> >>        <add key="RouterPrompt" value="AR601>" />
> >>        <add key="GetIpAddressCommand" value="config print" />
> >>        <add key="RouterQuitCommand" value="@close" />
> >>        <!-- FTP settings -->
> >>        <add key="FtpHost" value="www.cehjohnson.uklinux.net" />
> >>        <add key="FtpUsername" value="cehjohnson" />
> >>        <!-- Local file to which we save the ip address -->
> >>        <add key="LocalPath" value="aireip.txt" />
> >>        <add key="FtpPassword" value="2bon2btitq" />
> >>        <!-- Remote file to which we upload the IP address -->
> >>        <add key="RemotePath" value="/private/pieria.txt" />
> >>        <!-- How often (in milliseconds) we upload the IP 
> address -->
> >>        <add key="PollInterval" value="30000" />
> >>    </appSettings>
> >></configuration>
> >>
> >>Nicko Cadell wrote:
> >>
> >>    
> >>
> >>>Charles,
> >>>
> >>>This depends on how you have configured log4net. You may
> >>>      
> >>>
> >>need to mail
> >>    
> >>
> >>>your log4net configuration to get a more detailed analysis.
> >>>
> >>>If you are just using a FileAppender with a PatternLayout
> >>>      
> >>>
> >>with a Footer
> >>    
> >>
> >>>specified then the Footer will only be written when the 
> appender is 
> >>>closed. log4net hooks the application unload event and calls 
> >>>LogManager.Shutdown. There are circumstances outside the 
> control of 
> >>>log4net that can prevent the application unload event handler from 
> >>>running or completing.
> >>>
> >>>If you can explicitly call the LogManager.Shutdown() method
> >>>      
> >>>
> >>during you
> >>    
> >>
> >>>application exit then all output should be written correctly.
> >>>
> >>>Cheers,
> >>>Nicko
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>>>-----Original Message-----
> >>>>From: Charles Johnson [mailto:cj@cehjohnson.uklinux.net]
> >>>>Sent: 22 August 2005 12:14
> >>>>To: log4net-user@logging.apache.org
> >>>>Subject: Flushing?
> >>>>
> >>>>I seem to be getting irregular behaviour from my appender
> >>>>        
> >>>>
> >>(footer not
> >>    
> >>
> >>>>appearing etc.). I suspect the stream is not being flushed
> >>>>        
> >>>>
> >>properly. 
> >>    
> >>
> >>>>Is there any way i can force this?
> >>>>
> >>>>If another explanation is possible, please do say.
> >>>>
> >>>>CJ
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>> 
> >>>
> >>>      
> >>>
> >
> >Thanks Nicko, but there isn't one. Here it is:
> >  
> >
> <param name="ConversionPattern" value="%m" />
> 
> CJ
> 
> 
> 
> 
> 

Mime
View raw message