Wolfgang Uhr | 3 Jan 09:14 2011
Picon

There are some broken Links on the website ..

Hello

I'm just reading the documentation - http://logging.apache.org/log4net/release/manual/configuration.html and the chapter "Appenders". In the line "For examples of configuring appenders see the Example Appender Configuration document." the link to http://logging.apache.org/log4net/release/manual/example-config-appender.html is not working.

Best regards
Wolfgang
vikas | 3 Jan 06:26 2011
Picon

Re: Changing LockingModel at runtime

Vanderkolk, John <John.Vanderkolk <at> compuware.com> writes:

> 
> 
> 
> 
> Hello all,
> 
> 
> If in my config file I set all of my appenders as MinimalLock appenders, is 
it possible to later set a specific appender (which I already have code to 
grab) over to an ExclusiveLock? Also, if I set my config file as a read and 
watch, when/if it reloads the config file, will the appender be moved back to a 
MinimalLock, and if it will, is there any way of preventing this?
> 
> What would the code look like (in C#) to change the locking model at runtime 
assuming I've already extracted the appender from the repository.
> 
> John VanderKolk
> 
> john.vanderkolk <at> compuware.com
> 
> 
> The contents of this e-mail are intended for the named addressee only. It 
contains information that may be confidential. Unless you are the named 
addressee or an authorized designee, you may not copy or use it, or disclose it 
to anyone else. If you received it in error please notify us immediately and 
then destroy it.

Use 

.LockingModel = new FileAppender.MinimalLock(); 

Sam Carleton | 5 Jan 23:50 2011

No logging to SQLite

I have been using log4net for a years logging to text files, now it is time to log to SQLite.  Nothing is getting logged to the DB.  The logging is configured at runtime, so here is the process:

1: Create the logging DB
2: Load the baseline XML
3: make changes to a few elements, such as the path of the DB
4: call XmlConfigurator.Configure(logger)

I have turned on the log4net debugging, and below is the output from the call to XmlConfigurator.Configure.  Below that is the appender I am using.  Any thoughts on what I have wrong?  Note, when logging to a text file, it works fine.

Sam

XmlConfigurator.Configure output:
-----------------------------------------------
log4net: XmlConfigurator: Configuring Repository [log4net-default-repository]
log4net: XmlHierarchyConfigurator: Configuration update mode [Merge].
log4net: XmlHierarchyConfigurator: Logger [root] Level string is [DEBUG].
log4net: XmlHierarchyConfigurator: Logger [root] level set to [name="DEBUG",value=30000].
log4net: XmlHierarchyConfigurator: Loading Appender [AdoNetAppender] type: [log4net.Appender.AdoNetAppender]
log4net: XmlConfigurator: Configuring Repository [log4net-default-repository]
log4net: XmlHierarchyConfigurator: Configuration update mode [Merge].
log4net: XmlHierarchyConfigurator: Logger [root] Level string is [DEBUG].
log4net: XmlHierarchyConfigurator: Logger [root] level set to [name="DEBUG",value=30000].
log4net: XmlHierarchyConfigurator: Loading Appender [AdoNetAppender] type: [log4net.Appender.AdoNetAppender]
log4net: XmlHierarchyConfigurator: Setting Property [BufferSize] to Int32 value [100]
log4net: XmlHierarchyConfigurator: Setting Property [ConnectionType] to String value [System.Data.SQLite.SQLiteConnection, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139]
log4net: XmlHierarchyConfigurator: Setting Property [ConnectionString] to String value [Data Source=C:\Temp\Logs\logFile.sqlite; Version=3;]
log4net: XmlHierarchyConfigurator: Setting Property [CommandText] to String value [INSERT INTO Log (Date, Level, Logger, Message) VALUES ( <at> Date, <at> Level, <at> Logger, <at> Message)]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Date]
log4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [DateTime]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.RawTimeStampLayout]
log4net: XmlHierarchyConfigurator: Setting Property [BufferSize] to Int32 value [100]
log4net: XmlHierarchyConfigurator: Setting Property [ConnectionType] to String value [System.Data.SQLite.SQLiteConnection, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139]
log4net: XmlHierarchyConfigurator: Setting Property [ConnectionString] to String value [Data Source=C:\Temp\Logs\logFile.sqlite; Version=3;]
log4net: XmlHierarchyConfigurator: Setting Property [CommandText] to String value [INSERT INTO Log (Date, Level, Logger, Message) VALUES ( <at> Date, <at> Level, <at> Logger, <at> Message)]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Date]
log4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [DateTime]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.RawTimeStampLayout]
log4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenlog4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenderParameter]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Level]
log4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [String]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%level]
log4net: PatternParser: Converter [level] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.Layout2RawLayoutAdapter]
log4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenderParameter]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Logger]
derParameter]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Level]
log4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [String]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%level]
log4net: PatternParser: Converter [level] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.Layout2RawLayoutAdapter]
log4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenderParameter]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Logger]
log4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [String]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%logger]
log4net: PatternParser: Converter [logger] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.Layout2RawLayoutAdapter]
log4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenderParameter]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Message]
log4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [String]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,llog4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [String]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%logger]
log4net: PatternParser: Converter [logger] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.Layout2RawLayoutAdapter]
log4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenderParameter]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to String value [ <at> Message]
log4net: XmlHierarchyConfigurator: Setting Property [DbType] to DbType value [String]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%message]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.Layout2RawLayoutAdapter]
log4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenderParameter]
log4net: XmlHierarchyConfigurator: Created Appender [AdoNetAppender]
log4net: XmlHierarchyConfigurator: Adding appender named [AdoNetAppender] to logger [root].
log4net: XmlHierarchyConfigurator: Hierarchy Threshold []
eftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%message]
log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.Layout2RawLayoutAdapter]
log4net: XmlHierarchyConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.AdoNetAppenderParameter]
log4net: XmlHierarchyConfigurator: Created Appender [AdoNetAppender]
log4net: XmlHierarchyConfigurator: Adding appender named [AdoNetAppender] to logger [root].
log4net: XmlHierarchyConfigurator: Hierarchy Threshold []

And here is the file appender, the only thing that changes is

  <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
    <bufferSize value="100" />
    <connectionType value="System.Data.SQLite.SQLiteConnection, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    <connectionString value="Data Source=[filepath];Version=3;" />
    <commandText value="INSERT INTO Log (Date, Level, Logger, Message) VALUES ( <at> Date, <at> Level, <at> Logger, <at> Message)" />
    <parameter>
      <parameterName value=" <at> Date" />
      <dbType value="DateTime" />
      <layout type="log4net.Layout.RawTimeStampLayout" />
    </parameter>
    <parameter>
      <parameterName value=" <at> Level" />
      <dbType value="String" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%level" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value=" <at> Logger" />
      <dbType value="String" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%logger" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value=" <at> Message" />
      <dbType value="String" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%message" />
      </layout>
    </parameter>
  </appender>

kshah82 | 7 Jan 11:35 2011
Picon

Rollingstyle on date is not working for RollingFileAppender


Hi, 

We have set rollingstyle on date from my rollingfileappender. What we have
observered that when rolling takes place at 12:00 AM , it does not roll all
data from existing file where logging is happening.For example,  we have
checked around 11:59 the logging file size is around 1000 KB and it rolled
only 17KB of data. We have observered this behaviour for couple of days in a
row. Why is it happening ? Any idea on this. Following is
rollingfileappender configuration : 

    <appender name="RollingFileAppender"
type=log4net.Appender.RollingFileAppender"> 
    <threshold value ="ALL"/> 
    <file value="C:\LogFiles\test.log" /> 

    <appendToFile value="true" /> 
    <maximumFileSize value="1GB" /> 
    <staticLogFileName value="true"/> 
    <maxSizeRollBackups value="5" /> 
    <datePattern value=".yyyy-MM-dd".log""/> 
    <rollingStyle value="Composite" /> 

    <layout type="log4net.Layout.PatternLayout">       

   </layout> 
  </appender> 

Please revert on this ASAP as we are stuck on it.

--

-- 
View this message in context: http://old.nabble.com/Rollingstyle-on-date-is-not-working-for-RollingFileAppender-tp30613040p30613040.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

cyz | 14 Jan 05:28 2011

RollingFileAppender


Hi, I'd like to have a logging system with below behaviors, is
RollingFileAppender able to achieve?
1> messages are logged to a fixed file name, say log.txt.
2> log files are auto backup by sizes. I.e. when log.txt hits the configured
size, it's renamed as logyyMMddHHmmss.txt, next message coming in will be
written to log.txt again.
3> there is no limit on how many files can be backup.

Thank you.
--

-- 
View this message in context: http://old.nabble.com/RollingFileAppender-tp30668883p30668883.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Jim Scott | 14 Jan 06:50 2011

Re: RollingFileAppender

Try this

<appender name="RollingFileAppender" 
type="log4net.Appender.RollingFileAppender">
<file value="log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="-1" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<countDirection value="0" />
<param name="DatePattern" value=" logyyMMddHHmmss.txt" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger 
[%property{NDC}] - %message%newline" />
</layout>
</appender>

On 1/13/2011 8:28 PM, cyz wrote:
> Hi, I'd like to have a logging system with below behaviors, is
> RollingFileAppender able to achieve?
> 1>  messages are logged to a fixed file name, say log.txt.
> 2>  log files are auto backup by sizes. I.e. when log.txt hits the configured
> size, it's renamed as logyyMMddHHmmss.txt, next message coming in will be
> written to log.txt again.
> 3>  there is no limit on how many files can be backup.
>
> Thank you.

cyz | 14 Jan 07:01 2011

Re: RollingFileAppender


Tried the configuration, but the backup file name is still log.txt.1,
log.txt.2, doesn't append with datetime as specified in DatePattern

Jim Scott-8 wrote:
> 
> Try this
> 
> <appender name="RollingFileAppender" 
> type="log4net.Appender.RollingFileAppender">
> <file value="log.txt" />
> <appendToFile value="true" />
> <rollingStyle value="Size" />
> <maxSizeRollBackups value="-1" />
> <maximumFileSize value="10MB" />
> <staticLogFileName value="true" />
> <countDirection value="0" />
> 
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date [%thread] %-5level %logger 
> [%property{NDC}] - %message%newline" />
> </layout>
> </appender>
> 
> On 1/13/2011 8:28 PM, cyz wrote:
>> Hi, I'd like to have a logging system with below behaviors, is
>> RollingFileAppender able to achieve?
>> 1>  messages are logged to a fixed file name, say log.txt.
>> 2>  log files are auto backup by sizes. I.e. when log.txt hits the
>> configured
>> size, it's renamed as logyyMMddHHmmss.txt, next message coming in will be
>> written to log.txt again.
>> 3>  there is no limit on how many files can be backup.
>>
>> Thank you.
> 
> 

--

-- 
View this message in context: http://old.nabble.com/RollingFileAppender-tp30668883p30669112.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Michael Schall | 14 Jan 16:51 2011
Picon

Re: RollingFileAppender

http://logging.apache.org/log4net/release/config-examples.html

Looks like you want to have a rollingStyle="Composite"

On Fri, Jan 14, 2011 at 12:01 AM, cyz <zhouping <at> micron.com> wrote:

Tried the configuration, but the backup file name is still log.txt.1,
log.txt.2, doesn't append with datetime as specified in DatePattern


Jim Scott-8 wrote:
>
> Try this
>
> <appender name="RollingFileAppender"
> type="log4net.Appender.RollingFileAppender">
> <file value="log.txt" />
> <appendToFile value="true" />
> <rollingStyle value="Size" />
> <maxSizeRollBackups value="-1" />
> <maximumFileSize value="10MB" />
> <staticLogFileName value="true" />
> <countDirection value="0" />
>
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date [%thread] %-5level %logger
> [%property{NDC}] - %message%newline" />
> </layout>
> </appender>
>
> On 1/13/2011 8:28 PM, cyz wrote:
>> Hi, I'd like to have a logging system with below behaviors, is
>> RollingFileAppender able to achieve?
>> 1>  messages are logged to a fixed file name, say log.txt.
>> 2>  log files are auto backup by sizes. I.e. when log.txt hits the
>> configured
>> size, it's renamed as logyyMMddHHmmss.txt, next message coming in will be
>> written to log.txt again.
>> 3>  there is no limit on how many files can be backup.
>>
>> Thank you.
>
>

--
View this message in context: http://old.nabble.com/RollingFileAppender-tp30668883p30669112.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


cyz | 17 Jan 03:48 2011

Re: RollingFileAppender


Hi, do you mind to provide an example? I played around with the Composite
setting, but didn't get what I really want.

Michael Schall wrote:
> 
> http://logging.apache.org/log4net/release/config-examples.html
> 
> <http://logging.apache.org/log4net/release/config-examples.html>Looks like
> you want to have a rollingStyle="Composite"
> 
> On Fri, Jan 14, 2011 at 12:01 AM, cyz <zhouping <at> micron.com> wrote:
> 
>>
>> Tried the configuration, but the backup file name is still log.txt.1,
>> log.txt.2, doesn't append with datetime as specified in DatePattern
>>
>>
>> Jim Scott-8 wrote:
>> >
>> > Try this
>> >
>> > <appender name="RollingFileAppender"
>> > type="log4net.Appender.RollingFileAppender">
>> > <file value="log.txt" />
>> > <appendToFile value="true" />
>> > <rollingStyle value="Size" />
>> > <maxSizeRollBackups value="-1" />
>> > <maximumFileSize value="10MB" />
>> > <staticLogFileName value="true" />
>> > <countDirection value="0" />
>> >
>> > <layout type="log4net.Layout.PatternLayout">
>> > <conversionPattern value="%date [%thread] %-5level %logger
>> > [%property{NDC}] - %message%newline" />
>> > </layout>
>> > </appender>
>> >
>> > On 1/13/2011 8:28 PM, cyz wrote:
>> >> Hi, I'd like to have a logging system with below behaviors, is
>> >> RollingFileAppender able to achieve?
>> >> 1>  messages are logged to a fixed file name, say log.txt.
>> >> 2>  log files are auto backup by sizes. I.e. when log.txt hits the
>> >> configured
>> >> size, it's renamed as logyyMMddHHmmss.txt, next message coming in will
>> be
>> >> written to log.txt again.
>> >> 3>  there is no limit on how many files can be backup.
>> >>
>> >> Thank you.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/RollingFileAppender-tp30668883p30669112.html
>> Sent from the Log4net - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

--

-- 
View this message in context: http://old.nabble.com/RollingFileAppender-tp30668883p30676167.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Michael Schall | 17 Jan 17:24 2011
Picon

Re: RollingFileAppender

Re-reading your exact requirements, I'm not sure you can get exactly what you want with the built in
appenders. 

The current RollingFileAppender roles on size changing the log count portion of the file name and on date
changing the date portion. I think you would need to write your own appender if you want to change the date
when size rolls the file. 

Mike

On Jan 16, 2011, at 8:48 PM, cyz <zhouping <at> micron.com> wrote:

> 
> Hi, do you mind to provide an example? I played around with the Composite
> setting, but didn't get what I really want.
> 
> 
> Michael Schall wrote:
>> 
>> http://logging.apache.org/log4net/release/config-examples.html
>> 
>> <http://logging.apache.org/log4net/release/config-examples.html>Looks like
>> you want to have a rollingStyle="Composite"
>> 
>> On Fri, Jan 14, 2011 at 12:01 AM, cyz <zhouping <at> micron.com> wrote:
>> 
>>> 
>>> Tried the configuration, but the backup file name is still log.txt.1,
>>> log.txt.2, doesn't append with datetime as specified in DatePattern
>>> 
>>> 
>>> Jim Scott-8 wrote:
>>>> 
>>>> Try this
>>>> 
>>>> <appender name="RollingFileAppender"
>>>> type="log4net.Appender.RollingFileAppender">
>>>> <file value="log.txt" />
>>>> <appendToFile value="true" />
>>>> <rollingStyle value="Size" />
>>>> <maxSizeRollBackups value="-1" />
>>>> <maximumFileSize value="10MB" />
>>>> <staticLogFileName value="true" />
>>>> <countDirection value="0" />
>>>> 
>>>> <layout type="log4net.Layout.PatternLayout">
>>>> <conversionPattern value="%date [%thread] %-5level %logger
>>>> [%property{NDC}] - %message%newline" />
>>>> </layout>
>>>> </appender>
>>>> 
>>>> On 1/13/2011 8:28 PM, cyz wrote:
>>>>> Hi, I'd like to have a logging system with below behaviors, is
>>>>> RollingFileAppender able to achieve?
>>>>> 1>  messages are logged to a fixed file name, say log.txt.
>>>>> 2>  log files are auto backup by sizes. I.e. when log.txt hits the
>>>>> configured
>>>>> size, it's renamed as logyyMMddHHmmss.txt, next message coming in will
>>> be
>>>>> written to log.txt again.
>>>>> 3>  there is no limit on how many files can be backup.
>>>>> 
>>>>> Thank you.
>>>> 
>>>> 
>>> 
>>> --
>>> View this message in context:
>>> http://old.nabble.com/RollingFileAppender-tp30668883p30669112.html
>>> Sent from the Log4net - Users mailing list archive at Nabble.com.
>>> 
>>> 
>> 
>> 
> 
> -- 
> View this message in context: http://old.nabble.com/RollingFileAppender-tp30668883p30676167.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
> 


Gmane