kindaian@gmail.com | 1 Sep 01:48 2008
Picon

Visual Basic 2008 app.config errors...

Hi everyone,

I've a project in vb.net 2008 running, and i added log4net to it.

It was an issue to sort out what to do to add logging to the project but 
nothing special that some google couldn't help sort out.

The bigger issues where mainly what to add to app.config:

<configuration>
  <configSections>
    <section name="log4net" 
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, 
Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905" />
  </configSections> 
  <log4net debug="true">
    <appender name="RollingLogFileAppender" 
type="log4net.Appender.RollingFileAppender">
      <file value="C:\\TestLog.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="10MB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - 
%m%n" />
      </layout>
    </appender>
    <root>
(Continue reading)

Philipp Uhlmann | 1 Sep 08:54 2008
Picon

Question about using log4net with chainsaw

Hi

I'm using log4net and would like display log messages with apache
chainsaw.
For this reason I've added an UDPAppender. I got it to work but there
still exists a problem.
All messages are displayed in chainsaw in the default table. 
Because I have a lot of instances of my App running, I want to show the
log messages of each instance in its own table in apache chainsaw.
I read in the Tutorial that there is a property that is responsible in
which table the log message appears in chainsaw.
The name of this property is "application";
How can I add this property to my log-messages in log4net?
I'd like to do that programmatically.

I appreciate your help.

Best regards,
Philipp Uhlmann

Marc McGinley | 2 Sep 11:43 2008
Picon

Database logging problems

Hi,

 

I've been playing with log4net and writing to file seems to work okay =20 but when I try logging to a database nothing happens...

 

To explain a little more... I'm running a trace on the database and I =20 can see that it's trying to commit a transaction but it's not =20 resulting in any writes. I was playing with this for hours yesterday, =20 turned on the machine this morning and there were some rows in the =20 database. I've played around this morning (should have submitted at =20 least 30 logs from the same page (that worked last night)) and only =20 one of them has come through.

 

Is there some sort of buffer? The writing to db seems to be a little =20 erratic (I've no way to predict how often it writes) is there anything =20 I can do to sort this out?

 

Cheers!

 

Pascal ROZE | 2 Sep 11:52 2008
Picon

Re: Database logging problems

Hi

Try with <bufferSize value="0" /> in your appender definition.

Pascal

2008/9/2 Marc McGinley <marc <at> dreamspace.net>

Hi,

 

I've been playing with log4net and writing to file seems to work okay =20 but when I try logging to a database nothing happens...

 

To explain a little more... I'm running a trace on the database and I =20 can see that it's trying to commit a transaction but it's not =20 resulting in any writes. I was playing with this for hours yesterday, =20 turned on the machine this morning and there were some rows in the =20 database. I've played around this morning (should have submitted at =20 least 30 logs from the same page (that worked last night)) and only =20 one of them has come through.

 

Is there some sort of buffer? The writing to db seems to be a little =20 erratic (I've no way to predict how often it writes) is there anything =20 I can do to sort this out?

 

Cheers!

 


Marc McGinley | 2 Sep 12:10 2008
Picon

RE: Database logging problems

Brilliant, Thanks!

 

From: Pascal ROZE [mailto:pascal.roze <at> gmail.com]
Sent: 02 September 2008 10:52
To: Log4NET User
Subject: Re: Database logging problems

 

Hi

Try with <bufferSize value="0" /> in your appender definition.

Pascal

2008/9/2 Marc McGinley <marc <at> dreamspace.net>

Hi,

 

I've been playing with log4net and writing to file seems to work okay =20 but when I try logging to a database nothing happens...

 

To explain a little more... I'm running a trace on the database and I =20 can see that it's trying to commit a transaction but it's not =20 resulting in any writes. I was playing with this for hours yesterday, =20 turned on the machine this morning and there were some rows in the =20 database. I've played around this morning (should have submitted at =20 least 30 logs from the same page (that worked last night)) and only =20 one of them has come through.

 

Is there some sort of buffer? The writing to db seems to be a little =20 erratic (I've no way to predict how often it writes) is there anything =20 I can do to sort this out?

 

Cheers!

 

 

Mark Willis | 2 Sep 13:03 2008

Additivity flag question

Hello,
I'd like to control the Additivity flag programmatically. I know that it 
can be changed from the config file but want to change it within a 
program. The flag is a parameter of the Logger class but not on the ILog 
interface. If possible, what's the preferred method of doing this?
Thanks in advance,
Mark

Georg Jansen | 2 Sep 13:43 2008

RE: Additivity flag question

Mark,

I believe you can do something like:

log4net.ILog log = log4net.LogManager.GetLogger("LoggerName");
log4net.Repository.Hierarchy.Logger mylogger = log.Logger as
log4net.Repository.Hierarchy.Logger;
mylogger.Additivity = false;

Best regards
Georg
www.l4ndash.com - log4net Dashboard, Log analysis and monitoring made easy!

-----Original Message-----
From: Mark Willis [mailto:mark.willis <at> automation-consultants.com] 
Sent: 2. september 2008 13:04
To: log4net-user <at> logging.apache.org
Subject: Additivity flag question

Hello,
I'd like to control the Additivity flag programmatically. I know that it
can be changed from the config file but want to change it within a
program. The flag is a parameter of the Logger class but not on the ILog
interface. If possible, what's the preferred method of doing this?
Thanks in advance,
Mark

DawnC | 9 Sep 03:51 2008

logging from dll and application using sample app


Hello,

I am currently using you example the SimpleApp to log to different files for
the application and dll, which I need to do in my application.  I used a
rolling file appender with two different names.  What happens is that the
two files get created but the first file will end up into the dlls file
which I do not think should happen.  I would think that the main application
should keep logging to its file and the dll should log to the file that it
created.  Below is the configuration log4net file, output into the two log
files and the debugger output.  How do I get the dll and application to log
into different files?

Please Help Thanks,
Dawn

Below: configuration.log4net files:

<?xml version="1.0" encoding="utf-8" ?>
<!-- This section contains the log4net configuration settings -->
<log4net>
                <!-- Define some output appenders -->                
                <appender name="ConsoleAppender"
type="log4net.Appender.ConsoleAppender" >
                                <layout type="log4net.Layout.PatternLayout">
                                                <conversionPattern
value="[SimpleAppConfig] %date [%thread] %-5level %logger -
%message%newline" />
                                </layout>
                </appender>

  <appender name="mainRollingFileAppender"
type="log4net.Appender.RollingFileAppender">
      <file value="Output\\log\\log_MainSample.txt"/>
      <appendToFile value="false"/>
      <countDirection value="-1"/>
      <rollingStyle value="Composite" />
      <maxSizeRollBackups value="20" />
      <maximumFileSize value="10MB"/>
      <staticLogFileName value="true"/>
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/> 
      <layout type="log4net.Layout.PatternLayout">
        <!-- Print the date in ISO 8601 format -->
        <conversionPattern
value="%date|[%thread]|%logger|%message%newline"/>
      </layout>
    </appender>

                <!-- Setup the root category, add the appenders and set the
default level -->
                <root>
                                <level value="DEBUG" />
                                <appender-ref ref="mainRollingFileAppender"
/>
                </root>

</log4net>

Logfile Application: 
2008-09-08 18:18:24,362|[5340]|SimpleApp.EntryPoint|String[] {5, 8}
2008-09-08 18:18:24,379|[5340]|SimpleApp.EntryPoint|Adding [5] to [8]

Logfile Dll:
2008-09-08 18:18:24,414|[5340]|SimpleModule.Math|Constructor
2008-09-08 18:18:24,416|[5340]|SimpleModule.Math|5 + 8 = 13
2008-09-08 18:18:24,417|[5340]|SimpleApp.EntryPoint|Result [13]
2008-09-08 18:18:24,419|[5340]|SimpleApp.EntryPoint|Subtracting [8] from [5]
2008-09-08 18:18:24,464|[5340]|SharedModule.Math|Constructor
2008-09-08 18:18:24,466|[5340]|SharedModule.Math|5 - 8 = -3
2008-09-08 18:18:24,468|[5340]|SimpleApp.EntryPoint|Result [-3]
2008-09-08 18:18:24,470|[5340]|SimpleApp.EntryPoint|Result [-3]

Debugger Output:

'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleApp.vshost.exe',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll',
No symbols loaded.
The thread 0xbe8 has exited with code 0 (0x0).
The thread 0x11b4 has exited with code 0 (0x0).
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleApp.exe',
Symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\log4net.dll',
No symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll',
No symbols loaded.
log4net: log4net assembly [log4net, Version=1.2.10.0, Culture=neutral,
PublicKeyToken=1b44e1d426115821]. Loaded from
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\log4net.dll].
(.NET Runtime [2.0.50727.312] on Microsoft Windows NT 6.0.6000.0)
log4net: DefaultRepositorySelector: defaultRepositoryType
[log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository for assembly
[SimpleApp, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null]
log4net: DefaultRepositorySelector: Assembly [SimpleApp, Version=1.2.10.0,
Culture=neutral, PublicKeyToken=null] Loaded From
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleApp.exe]
log4net: DefaultRepositorySelector: Assembly [SimpleApp, Version=1.2.10.0,
Culture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute
specified.
log4net: DefaultRepositorySelector: Assembly [SimpleApp, Version=1.2.10.0,
Culture=neutral, PublicKeyToken=null] using repository
[log4net-default-repository] and repository type
[log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository
[log4net-default-repository] using type
[log4net.Repository.Hierarchy.Hierarchy]
log4net: XmlConfigurator: configuring repository
[log4net-default-repository] using file
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleApp.exe.log4net]
watching for file updates
log4net: XmlConfigurator: configuring repository
[log4net-default-repository] using file
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleApp.exe.log4net]
log4net: XmlConfigurator: configuring repository
[log4net-default-repository] using stream
log4net: XmlConfigurator: loading XML configuration
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
[mainRollingFileAppender] type: [log4net.Appender.RollingFileAppender]
log4net: XmlHierarchyConfigurator: Setting Property [File] to String value
[Output\\log\\log_MainSmaple.txt]
log4net: XmlHierarchyConfigurator: Setting Property [AppendToFile] to
Boolean value [False]
log4net: XmlHierarchyConfigurator: Setting Property [CountDirection] to
Int32 value [-1]
log4net: XmlHierarchyConfigurator: Setting Property [RollingStyle] to
RollingMode value [Composite]
log4net: XmlHierarchyConfigurator: Setting Property [MaxSizeRollBackups] to
Int32 value [20]
log4net: XmlHierarchyConfigurator: Setting Property [MaximumFileSize] to
String value [10MB]
log4net: XmlHierarchyConfigurator: Setting Property [StaticLogFileName] to
Boolean value [True]
log4net: XmlHierarchyConfigurator: Setting Property [LockingModel] to object
[log4net.Appender.FileAppender+MinimalLock]
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 [%date|[%thread]|%logger|%message%newline]
log4net: PatternParser: Converter [date] Option [] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [literal] Option [|[] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [thread] Option [] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [literal] Option []|] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [logger] Option [] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [literal] Option [|] Format
[min=-1,max=2147483647,leftAlign=False]
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 [Layout] to object
[log4net.Layout.PatternLayout]
log4net: RollingFileAppender: Type = [0], r0 = [.1970-01-01], r1 =
[.1970-01-01]
log4net: RollingFileAppender: Type = [1], r0 = [.1970-01-01], r1 =
[.1970-01-01]
log4net: RollingFileAppender: Type = [2], r0 = [.1970-01-01], r1 =
[.1970-01-01]
log4net: RollingFileAppender: Type = [3], r0 = [.1970-01-01], r1 =
[.1970-01-02]
log4net: RollingFileAppender: Searched for existing files in
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log]
log4net: RollingFileAppender: curSizeRollBackups starts at [0]
log4net: RollingFileAppender: [.2008-09-08] vs. [.2008-09-08]
log4net: RollingFileAppender: Output file
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_MainSmaple.txt]
already exists. Not appending to file. Rolling existing file out of the way.
log4net: RollingFileAppender: Moving
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_MainSmaple.txt]
->
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_MainSmaple.txt.1]
log4net: FileAppender: Opening file for writing
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_MainSmaple.txt]
append [False]
log4net: XmlHierarchyConfigurator: Created Appender
[mainRollingFileAppender]
log4net: XmlHierarchyConfigurator: Adding appender named
[mainRollingFileAppender] to logger [root].
log4net: XmlHierarchyConfigurator: Hierarchy Threshold []
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleModule.dll',
Symbols loaded.
'SimpleApp.vshost.exe' (Managed): Loaded
'C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SharedModule.dll',
Symbols loaded.
log4net: DefaultRepositorySelector: Creating repository for assembly
[SimpleModule, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null]
log4net: DefaultRepositorySelector: Assembly [SimpleModule,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=null] Loaded From
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleModule.dll]
log4net: DefaultRepositorySelector: Assembly [SimpleModule,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=null] using repository
[SimpleModule] and repository type [log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Aliasing repository [SimpleModule] to
existing repository [log4net-default-repository]
log4net: XmlConfigurator: configuring repository
[log4net-default-repository] using file
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleModule.dll.log4net]
watching for file updates
log4net: XmlConfigurator: configuring repository
[log4net-default-repository] using file
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SimpleModule.dll.log4net]
log4net: XmlConfigurator: configuring repository
[log4net-default-repository] using stream
log4net: XmlConfigurator: loading XML configuration
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 [RollingFileAppender]
type: [log4net.Appender.RollingFileAppender]
log4net: XmlHierarchyConfigurator: Setting Property [File] to String value
[Output\\log\\log_Sample.txt]
log4net: XmlHierarchyConfigurator: Setting Property [AppendToFile] to
Boolean value [False]
log4net: XmlHierarchyConfigurator: Setting Property [CountDirection] to
Int32 value [-1]
log4net: XmlHierarchyConfigurator: Setting Property [RollingStyle] to
RollingMode value [Composite]
log4net: XmlHierarchyConfigurator: Setting Property [MaxSizeRollBackups] to
Int32 value [20]
log4net: XmlHierarchyConfigurator: Setting Property [MaximumFileSize] to
String value [10MB]
log4net: XmlHierarchyConfigurator: Setting Property [StaticLogFileName] to
Boolean value [True]
log4net: XmlHierarchyConfigurator: Setting Property [LockingModel] to object
[log4net.Appender.FileAppender+MinimalLock]
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 [%date|[%thread]|%logger|%message%newline]
log4net: PatternParser: Converter [date] Option [] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [literal] Option [|[] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [thread] Option [] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [literal] Option []|] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [logger] Option [] Format
[min=-1,max=2147483647,leftAlign=False]
log4net: PatternParser: Converter [literal] Option [|] Format
[min=-1,max=2147483647,leftAlign=False]
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 [Layout] to object
[log4net.Layout.PatternLayout]
log4net: RollingFileAppender: Type = [0], r0 = [.1970-01-01], r1 =
[.1970-01-01]
log4net: RollingFileAppender: Type = [1], r0 = [.1970-01-01], r1 =
[.1970-01-01]
log4net: RollingFileAppender: Type = [2], r0 = [.1970-01-01], r1 =
[.1970-01-01]
log4net: RollingFileAppender: Type = [3], r0 = [.1970-01-01], r1 =
[.1970-01-02]
log4net: RollingFileAppender: Searched for existing files in
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log]
log4net: RollingFileAppender: curSizeRollBackups starts at [0]
log4net: RollingFileAppender: [.2008-09-08] vs. [.2008-09-08]
log4net: RollingFileAppender: Output file
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_Sample.txt]
already exists. Not appending to file. Rolling existing file out of the way.
log4net: RollingFileAppender: Moving
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_Sample.txt]
->
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_Sample.txt.1]
log4net: FileAppender: Opening file for writing
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\Output\log\log_Sample.txt]
append [False]
log4net: XmlHierarchyConfigurator: Created Appender [RollingFileAppender]
log4net: XmlHierarchyConfigurator: Adding appender named
[RollingFileAppender] to logger [root].
log4net: XmlHierarchyConfigurator: Hierarchy Threshold []
log4net: DefaultRepositorySelector: Creating repository for assembly
[SharedModule, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null]
log4net: DefaultRepositorySelector: Assembly [SharedModule,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=null] Loaded From
[C:\download\log4net\log4net-1.2.10\examples\net\1.0\Repository\SimpleApp\cs\build\debug\SharedModule.dll]
log4net: DefaultRepositorySelector: Assembly [SharedModule,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=null] does not have a
RepositoryAttribute specified.
log4net: DefaultRepositorySelector: Assembly [SharedModule,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=null] using repository
[log4net-default-repository] and repository type
[log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: repository [log4net-default-repository]
already exists, using repository type
[log4net.Repository.Hierarchy.Hierarchy]

--

-- 
View this message in context: http://www.nabble.com/logging-from-dll-and-application-using-sample-app-tp19384571p19384571.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

CLaco | 10 Sep 18:44 2008

GAC vs. XmlHierarchyConfigurator Problem

I've found a few posts on Google about this issue, but none seem to be the exact problem I'm having.
When I started adding log4net to some of my projects, I just added a reference to the dll, which was then copied to the output directory.

I added this following code to my AssemblyInfo file, setup the app.config and everything worked like a champ.

  <Assembly: log4net.Config.XmlConfigurator(Watch:=True)>

I then installed log4net into the GAC on the servers and then on my machine and removed all copies from bin. Everything compiles, and even runs fine, but nothing is logged.

After turning on log4net internal debug logging,. I see the text below in the log4net trace.

Clearly, It's loading log4net from the GAC to start with, but then stalls out during the XmlHierarchyConfigurator part of the process.

Any ideas?

Of course, if I place a copy in bin, it works; thus defeating the purpose of installing it into the GAC.

-=Chris

---
log4net: log4net assembly [log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821]. Loaded from [Global Assembly Cache]. (.NET Runtime [2.0.50727.3053] on Microsoft Windows NT 5.1.2600 Service Pack 2)

log4net: DefaultRepositorySelector: defaultRepositoryType [log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository for assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1]

log4net: DefaultRepositorySelector: Assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1] Loaded From [C:\Development\OrderImportService\bin\Debug\SRE.Services.OrderImportService.exe]

log4net: DefaultRepositorySelector: Assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1] does not have a RepositoryAttribute specified.

log4net: DefaultRepositorySelector: Assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy]

log4net: DefaultRepositorySelector: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]

log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [C:\Development\OrderImportService\bin\Debug\SRE.Services.OrderImportService.exe.config] watching for file updates

log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [C:\Development\OrderImportService\bin\Debug\SRE.Services.OrderImportService.exe.config]

log4net: XmlConfigurator: configuring repository [log4net-default-repository] using stream
log4net: XmlConfigurator: loading XML configuration
log4net: XmlConfigurator: Configuring Repository [log4net-default-repository]
log4net: XmlHierarchyConfigurator: Configuration update mode [Merge].
log4net: XmlHierarchyConfigurator: Logger [root] Level string is [ALL].
log4net: XmlHierarchyConfigurator: Logger [root] level set to [name="ALL",value=-2147483648].
log4net: XmlHierarchyConfigurator: Loading Appender [LogFileAppender] type: [log4net.Appender.RollingFileAppender,log4net]

log4net:ERROR XmlHierarchyConfigurator: Could not create Appender [LogFileAppender] of type [log4net.Appender.RollingFileAppender,log4net]. Reported error follows.

System.IO.FileNotFoundException: Could not load file or assembly 'log4net' or one of its dependencies. The system cannot find the file specified.

File name: 'log4net'
   at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)

   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)

   at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)

   at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase)

   at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

log4net:ERROR XmlHierarchyConfigurator: Appender named [LogFileAppender] not found.


CLaco | 10 Sep 18:57 2008

RE: GAC vs. XmlHierarchyConfigurator Problem

This would be because I'm an idiot. :-)
I have the type in configSection set to the full GAC version/pubkey, but I didn't have the full type set when defining appenders. Bigh duh.
 
-=Chris

From: CLaco <at> SummitRacing.com [mailto:CLaco <at> SummitRacing.com]
Sent: Wednesday, September 10, 2008 12:45 PM
To: log4net-user <at> logging.apache.org
Subject: GAC vs. XmlHierarchyConfigurator Problem

I've found a few posts on Google about this issue, but none seem to be the exact problem I'm having.
When I started adding log4net to some of my projects, I just added a reference to the dll, which was then copied to the output directory.

I added this following code to my AssemblyInfo file, setup the app.config and everything worked like a champ.

  <Assembly: log4net.Config.XmlConfigurator(Watch:=True)>

I then installed log4net into the GAC on the servers and then on my machine and removed all copies from bin. Everything compiles, and even runs fine, but nothing is logged.

After turning on log4net internal debug logging,. I see the text below in the log4net trace.

Clearly, It's loading log4net from the GAC to start with, but then stalls out during the XmlHierarchyConfigurator part of the process.

Any ideas?

Of course, if I place a copy in bin, it works; thus defeating the purpose of installing it into the GAC.

-=Chris

---
log4net: log4net assembly [log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821]. Loaded from [Global Assembly Cache]. (.NET Runtime [2.0.50727.3053] on Microsoft Windows NT 5.1.2600 Service Pack 2)

log4net: DefaultRepositorySelector: defaultRepositoryType [log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository for assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1]

log4net: DefaultRepositorySelector: Assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1] Loaded From [C:\Development\OrderImportService\bin\Debug\SRE.Services.OrderImportService.exe]

log4net: DefaultRepositorySelector: Assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1] does not have a RepositoryAttribute specified.

log4net: DefaultRepositorySelector: Assembly [SRE.Services.OrderImportService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c5b9e92786b57ef1] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy]

log4net: DefaultRepositorySelector: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]

log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [C:\Development\OrderImportService\bin\Debug\SRE.Services.OrderImportService.exe.config] watching for file updates

log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [C:\Development\OrderImportService\bin\Debug\SRE.Services.OrderImportService.exe.config]

log4net: XmlConfigurator: configuring repository [log4net-default-repository] using stream
log4net: XmlConfigurator: loading XML configuration
log4net: XmlConfigurator: Configuring Repository [log4net-default-repository]
log4net: XmlHierarchyConfigurator: Configuration update mode [Merge].
log4net: XmlHierarchyConfigurator: Logger [root] Level string is [ALL].
log4net: XmlHierarchyConfigurator: Logger [root] level set to [name="ALL",value=-2147483648].
log4net: XmlHierarchyConfigurator: Loading Appender [LogFileAppender] type: [log4net.Appender.RollingFileAppender,log4net]

log4net:ERROR XmlHierarchyConfigurator: Could not create Appender [LogFileAppender] of type [log4net.Appender.RollingFileAppender,log4net]. Reported error follows.

System.IO.FileNotFoundException: Could not load file or assembly 'log4net' or one of its dependencies. The system cannot find the file specified.

File name: 'log4net'
   at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)

   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)

   at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)

   at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase)

   at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

log4net:ERROR XmlHierarchyConfigurator: Appender named [LogFileAppender] not found.



Gmane