logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Carleton <scarle...@miltonstreet.com>
Subject No logging to SQLite
Date Wed, 05 Jan 2011 22:50:33 GMT
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 (@Date, @Level,
@Logger, @Message)]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to
String value [@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 (@Date, @Level,
@Logger, @Message)]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to
String value [@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 [@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 [@Logger]
derParameter]
log4net: XmlHierarchyConfigurator: Setting Property [ParameterName] to
String value [@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 [@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 [@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 [@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 (@Date, @Level, @Logger, @Message)" />
    <parameter>
      <parameterName value="@Date" />
      <dbType value="DateTime" />
      <layout type="log4net.Layout.RawTimeStampLayout" />
    </parameter>
    <parameter>
      <parameterName value="@Level" />
      <dbType value="String" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%level" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@Logger" />
      <dbType value="String" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%logger" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@Message" />
      <dbType value="String" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%message" />
      </layout>
    </parameter>
  </appender>

Mime
View raw message