logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DawnC <da...@gen-probe.com>
Subject logging from dll and application using sample app
Date Tue, 09 Sep 2008 01:51:46 GMT

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.


Mime
View raw message