Patrick,

You have created an App.config file in your project.
Can you confirm that this is also being copied to the Device.
The file should be called YourApp.exe.config and be in the same directory as 
the executable.

As far as I remember (and looking at the NetCF example in the log4net 1.2 beta 
8 download) I think that Visual Studio automatically manages the App.config 
like it does for a full .NET framework project.

Also if you use internal log4net debugging this will also show where log4net is 
trying to read the configuration from.

Cheers,
Nicko

> -----Original Message-----
> From: Patrick [mailto:[EMAIL PROTECTED] 
> Sent: 29 November 2004 17:07
> To: Nicko Cadell
> Subject: AW: ADONetAppender
> 
> Dear Mr. Cardell!
> 
> Yes, but I think I have forgotten something fundamental. 
> Because when I try the FileAppender or the ConsoleAppender - 
> these also won't work. (As said I work this out for a Smart 
> Device Application for a PocketPc) I explain you which steps 
> I did to set a FileAppender:
> 
> I add a new item (a TextFile) to my project and called it 
> App.config. In that file I add the following code:
> 
> <configuration>
>       <configSections>
>               <section name="log4net"
>       
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
> 
>       </configSections>
>       <log4net>
>               <appender name="FileAppender"
> type="log4net.Appender.FileAppender">
>                       <param name="File" value="log-file.txt" />
>                       <param name="AppendToFile" value="true" />
>                       <layout type="log4net.Layout.PatternLayout">
>                               <param name="ConversionPattern" 
> value="%d [%t] %-5p %c [%x] - %m%n" />
>                       </layout>
>               </appender>             
>               <root>
>                       <level value="INFO" />
>                       <appender-ref ref="LogFileAppender" />
>               </root>>                
>       </log4net>
> </configuration>
> 
> In the Form1.cs I add the following line where the other fields are
> situated:
> private static readonly log4net.ILog log = 
> log4net.LogManager.GetLogger(typeof(Form1));
> 
> And in the constructor of the MainForm I add the following:
> 
> log4net.Config.DOMConfigurator.Configure();
> 
> log.Info("This is a sample message!");
> 
> This was all I have done. But as said at the ADONetAppender, 
> nothing happens when I execute this Sample Mobile 
> Application. No file is created on my PocketPc, nothing.
> 
> Can you please tell me what I have forgotten or made wrong??
> 
> Best Regards
> 
> 
> --------------------------
> Patrick Achatschitz, Bakk.
> Fasangasse 8/3
> 1030 Vienna
> Austria
>  
> Mobile: 01 650 270 8819
> 
> -----Urspr�ngliche Nachricht-----
> Von: Nicko Cadell [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 29. November 2004 17:53
> An: Log4NET User
> Betreff: RE: ADONetAppender
> 
> Patrick,
> 
> Have you tried enabling log4net internal debug so that you 
> can get a trace of any errors that may be occurring when 
> connecting to the database?
> See: 
> http://logging.apache.org/log4net/release/manual/faq.html#inte
> rnalDebug
> 
> 
> Cheers,
> Nicko
> 
> > -----Original Message-----
> > From: Patrick [mailto:[EMAIL PROTECTED]
> > Sent: 29 November 2004 15:54
> > To: 'Log4NET User'
> > Subject: ADONetAppender
> > 
> > Dear Mr. Cadell!
> > 
> > I want to use the DataAppender of log4net to save 
> log-information in a 
> > Database of my Smart Device Application.
> > 
> > My dataTable looks as follows:
> > 
> > Date           nvarchar        50
> > UserName       nvarchar        50   
> > ClassName      nvarchar        50   
> > Method         nvarchar        50   
> > Description    nvarchar        50   
> > Parameters  nvarchar   200  
> > rowguid     uniqueidentifier        16      
> > 
> > My app.config file looks as follows:
> > 
> > 
> > <?xml version="1.0" encoding="utf-8" ?>
> > 
> > <!-- .NET application configuration file
> > 
> >      The .NET Compact Framework does not support application 
> > configuration files,
> >      but log4net supports using configuration files with 
> similar names 
> > and structure,
> >      to store the log4net configuration.
> >  -->
> > 
> > <configuration>
> >     <configSections>
> >             <section name="log4net" 
> > type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
> >     </configSections>
> >     <log4net>
> > 
> > <appender name="ADONetAppender_SqlServer" 
> > type="log4net.Appender.ADONetAppender" >
> >               <param name="ConnectionType" 
> > value="System.Data.SqlClient.SqlConnection, System.Data, 
> > Version=1.0.3300.0,
> > 
> > Culture=neutral, PublicKeyToken=b77a5c561934e089" />
> >               <param name="ConnectionString" 
> > value="workstation id=ACHATSCHITZ;packet size=4096;user 
> > id=sa;pwd=sa;data source=achatschitz;persist security 
> > info=False;initial catalog=HelpDesk" /> <commandText value="INSERT 
> > INTO Instrumentation 
> > ([Date],[UserName],[ClassName],[Method],[Description],[Paramet
> > ers]) VALUES 
> >          (@log_date, @thread, @log_level, @logger, @message, 
> > @exception)" />
> >       <parameter>
> >          <parameterName value="@log_date" />
> >          <dbType value="DateTime" />
> >          <layout type="log4net.Layout.RawTimeStampLayout" />
> >       </parameter>
> >       <parameter>
> >          <parameterName value="@thread" />
> >          <dbType value="String" />
> >          <size value="50" />
> >          <layout type="log4net.Layout.PatternLayout">
> >             <conversionPattern value="%t" />
> >          </layout>
> >       </parameter>
> >       <parameter>
> >          <parameterName value="@log_level" />
> >          <dbType value="String" />
> >          <size value="50" />
> >          <layout type="log4net.Layout.PatternLayout">
> >             <conversionPattern value="%p" />
> >          </layout>
> >       </parameter>
> >       <parameter>
> >          <parameterName value="@logger" />
> >          <dbType value="String" />
> >          <size value="50" />
> >          <layout type="log4net.Layout.PatternLayout">
> >             <conversionPattern value="%c" />
> >          </layout>
> >       </parameter>
> >       <parameter>
> >          <parameterName value="@message" />
> >          <dbType value="String" />
> >          <size value="50" />
> >          <layout type="log4net.Layout.PatternLayout">
> >             <conversionPattern value="%m" />
> >          </layout>
> >       </parameter>
> >       <parameter>
> >          <parameterName value="@exception" />
> >          <dbType value="String" />
> >          <size value="200" />
> >          <layout type="log4net.Layout.ExceptionLayout" />
> >       </parameter>
> >    </appender>
> >    <root>
> >       <level value="DEBUG" />
> >       <appender-ref ref="ADONetAppender" />
> >    </root>
> > 
> >     </log4net>
> > 
> > </configuration>
> >  
> > And in my application I wrote the following code:
> > 
> > protected static readonly ILog log =
> > LogManager.GetLogger(typeof(Login));
> > log4net.Config.DOMConfigurator.Configure();
> > 
> > and in the method where I want to log information I add the 
> following:
> > 
> > log.Debug("The program got here!");
> > LogManager.Shutdown();
> > 
> > But when I execute my application and invoke this method, nothing 
> > happens.
> > Can you please help me what went wrong here?
> > 
> > Best Regards
> > 
> > --------------------------
> > Patrick Achatschitz, Bakk.
> > Fasangasse 8/3
> > 1030 Vienna
> > Austria
> >  
> > Mobile: 01 650 270 8819
> > 
> > -----Urspr�ngliche Nachricht-----
> > Von: Nicko Cadell [mailto:[EMAIL PROTECTED]
> > Gesendet: Montag, 29. November 2004 16:48
> > An: Log4NET User
> > Betreff: RE: RollingFileAppender does not log to the file
> > 
> > Marco,
> > 
> > The debug output looks like everything is working as it should.
> > Can you confirm that the output file
> > "C:\Inetpub\wwwroot\amt\log\AMTLogger.log" is being created, and is 
> > empty.
> > 
> > Also I was wondering where the "2004-11-26 10:33:11,527 [2112]
> > test.Application_Start() - Test aus Application_Start" 
> > message cam from, it looks like it is output through the A_Console 
> > appender, however I don't think that the ASP.NET service 
> should have a 
> > Console attached (unless you are hosting ASP.NET in your 
> own Console 
> > App).
> > 
> > What is the configuration file you are using?
> > 
> > Cheers,
> > Nicko
> > 
> > > -----Original Message-----
> > > From: Marco Herrn [mailto:[EMAIL PROTECTED]
> > > Sent: 26 November 2004 15:40
> > > To: [email protected]
> > > Subject: RollingFileAppender does not log to the file
> > > 
> > > Hi,
> > > 
> > > I have a problem with using log4net in an ASP.NET 
> application. The 
> > > debug output of log4net says that it loads the log4net 
> config file 
> > > correctly and also opens the log file for reading. But nothing is 
> > > written to the file. The debug output is appended to this mail.
> > > Any ideas what can be the problem here?
> > > 
> > > Regards
> > > Marco
> > > 
> > 
> > 
> 
> 

Reply via email to