Re: no log file is created

2007-06-27 Thread Samuel Rochas

Dear Michael,

I have changed my app to write a file using a TextWriter and this is 
working so I believe my app has rights to write files. But I still have 
the log problem, no log file is created.


Do you have any suggestion on what should I try now?

Regards
Samuel

Michael Schall escribió:

You don't need to escape them.  Here is my appender declaration...

appender name=RollingFile 
type=log4net.Appender.RollingFileAppender
file 
value=C:\Projects\Company_Name\Project_Name\log\web.log /

appendToFile value=true /
maximumFileSize value=100MB /
maxSizeRollBackups value=-1 /
layout type=log4net.Layout.PatternLayout 
conversionPattern value=%5level [%date] [%thread] 
%-30.30logger{2}%message%newline /

/layout
/appender

On 6/22/07, *Samuel Rochas* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Dear Michael,

I run the web server which comes with studio. I am not sure how /
where
to configure it. I open the IIS tool, and in the Default web site
properties, I setup the directory rights to write. But no change
is to see.

Do you need to escape the '\' characters like you do in Java for the
absolute file path like C:\\path1\\path2\\file.txt?

Thank you
Samuel

Michael Schall escribió:
 The user the application is running as has to have rights to
write to
 / create files in the folder where you are logging.  Keep in
mind that
 if you are debugging, that might be a different relative path
than if
 you are running the program directly.  I use an absolute path
for my
 rolling file appenders and they work great.

 Mike





--


Re: no log file is created

2007-06-27 Thread Samuel Rochas




Dear Michael, 

I've tried to define an EventLogAppender as shown bellow, but still
nothing happens. I may have a bigger problem ;-)
In the Solution Explorer view, I can see the Bin directory with the
log4net.dll inside, so for me it looks good.

If I use an external config file for log4net, where do I tell my
application to use it?

Thanx
Samuel

web.config:
configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"
 !-- Register a section handler for the log4net section --
 configSections
 section name="log4net"
type="System.Configuration.IgnoreSectionHandler" /
 /configSections
 appSettings
 /appSettings
 !-- This section contains the log4net configuration settings
--
 log4net
 !-- Define some output appenders --
 appender name="EventLogAppender"
type="log4net.Appender.EventLogAppender" 
 layout type="log4net.Layout.PatternLayout"
 conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" /
 /layout
 /appender
 appender name="A1"
type="log4net.Appender.RollingFileAppender"
 file value="C:\Dev\Test\log\log.txt" /
 appendToFile value="true" /
 maxSizeRollBackups value="10" /
 maximumFileSize value="1024KB" /
 rollingStyle value="Size" /
 staticLogFileName value="true" /
 layout type="log4net.Layout.PatternLayout"
 conversionPattern value="%date [%thread] %-5level %logger
[%ndc] - %message%newline" /
 /layout
 /appender
 root
 level value="DEBUG" /
 appender-ref ref="EventLogAppender" /
 /root
 logger name="com.mypackage.test" 
 level value="DEBUG" /
 appender-ref ref="EventLogAppender" /
 /logger
 /log4net

Michael Schall escribi:
Are any of the other appenders working(EventViewer,
Console)? If not are you configuring log4net? I see you have your
configuration in your web config file. We don't do it this way.
  
If the others are working, it has to be in your config file or
environment...
  
  
We use external config files and configure it manually during
Application_Start in the global.asax. Below is a sample of our
Web.log4net.config file. This way we can change logging without
resetting the web site.
  
  
log4net
  
 appender name="RollingFile"
type="log4net.Appender.RollingFileAppender"
  file value="..\..\log\Regen.log" /
  rollingStyle value="Composite" /
  
  appendToFile value="false" /
  datePattern value="MMdd" /
  maximumFileSize value="100MB" /
  maxSizeRollBackups value="-1" /
  
  StaticLogFileName value="false" /
  layout type="log4net.Layout.PatternLayout"
   conversionPattern value="%5level [%date] [%thread]
%-30.30logger{2}
 %message%newline" /
  /layout
 /appender
  
 appender name="EventLog"
type="log4net.Appender.EventLogAppender" 
  applicationName value="Regen" /
  
  filter type="log4net.Filter.LevelRangeFilter"
   levelMin value="INFO" /
  /filter
  layout type="log4net.Layout.PatternLayout
"
   conversionPattern value="%logger %newline %message"
/
  /layout
 /appender
 
 root
  level value="DEBUG" /
  
  appender-ref ref="RollingFile" /
  appender-ref ref="EventLog" /
 /root
  
/log4net
  
  On 6/27/07, 
Samuel Rochas [EMAIL PROTECTED]
wrote:
  
Dear Michael, 

I have changed my app to write a file using a TextWriter and this is
working so I believe my app has rights to write files. But I still have
the log problem, no log file is created.

Do you have any suggestion on what should I try now?

Regards
Samuel

Michael Schall escribi:

You don't need to escape them. Here is my appender
declaration...
  
 appender name="RollingFile"
type="log4net.Appender.RollingFileAppender"
  file
value="C:\Projects\Company_Name\Project_Name\log\web.log" / 
  appendToFile value="true" /
  maximumFileSize value="100MB" /
  maxSizeRollBackups value="-1" /
  layout type="log4net.Layout.PatternLayout
"
   conversionPattern value="%5level [%date] [%thread]
%-30.30logger{2} %message%newline" /
  /layout
 /appender
  
  On 6/22/07, Samuel Rochas [EMAIL PROTECTED]
  
wrote:
  Dear
Michael,

I run the web server which comes with studio. I am not sure how / where
to configure it. I open the IIS tool, and in the "Default web site"
properties, I setup the directory rights to write. But no change is to
see. 

Do you need to escape the '\' characters like you do in Java for the
absolute file path like "C:\\path1\\path2\\file.txt"?

Thank you
Samuel

Michael Schall escribi:
 The user the application is running as has to have rights to write
to 
 / create files in the folder where you are logging.Keep in mind
that
 if you are debugging, that might be a different relative path than
if
 you are running the program directly.I use an absolute path for
my 
 rolling file appenders and they work great.

 Mike


  
  
  



--


  
  
  


-- 










  

  
   
   
  
  
   
  
  
   Samuel Rochas  
  
International Education Systems (IES) 
Technological Resources 
Paseo Conde 

Re: no log file is created

2007-06-27 Thread Samuel Rochas

Dear Alvaro,

I've changed my config according to yours but I still can't log. How 
could I try to troubleshoot?


Samuel

Alvaro Rozo escribió:

Samuel,

Try the following, this works for me in my web.config:

?xml version=1.0?
configuration
configSections
section name=log4net type=log4net.Config 
.Log4NetConfigurationSectionHandler, log4net/

/configSections
More web config stuff
log4net
!-- RollingFileAppender looks after rolling over files by 
size or date --
appender name=RollingFileAppender 
type=log4net.Appender.RollingFileAppender

file value=C:\\Dev\\Test\\log\\log.txt/
param name=AppendToFile value=true/
param name=MaxSizeRollBackups value=10/
param name=MaximumFileSize value=10/
param name=RollingStyle value=Size/
param name=StaticLogFileName value=true/
layout type=log4net.Layout.PatternLayout 
param name=ConversionPattern value==%date 
[%thread] %-5level %logger [%ndc] - %message%newline/

/layout
/appender
!-- Setup the root category, add the appenders and set the 
default level --

root
level value=DEBUG/
appender-ref ref=RollingFileAppender/
/root
/log4net
/configuration


On 6/27/07, Samuel Rochas [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


 Dear Michael,

 I've tried to define an EventLogAppender as shown bellow, but still 
nothing happens. I may have a bigger problem ;-)
 In the Solution Explorer view, I can see the Bin directory with the 
log4net.dll inside, so for me it looks good.


 If I use an external config file for log4net, where do I tell my 
application to use it?


 Thanx
 Samuel

 web.config:
 configuration xmlns= 
http://schemas.microsoft.com/.NetConfiguration/v2.0;

   !-- Register a section handler for the log4net section --
   configSections
 section name=log4net 
type=System.Configuration.IgnoreSectionHandler /

   /configSections
   appSettings
   /appSettings
   !-- This section contains the log4net configuration settings --
   log4net
 !-- Define some output appenders --
 appender name=EventLogAppender 
type=log4net.Appender.EventLogAppender 

   layout type= log4net.Layout.PatternLayout
 conversionPattern value=%date [%thread] %-5level %logger 
[%property{NDC}] - %message%newline /

   /layout
 /appender
 appender name=A1 type=log4net.Appender.RollingFileAppender
   file value=C:\Dev\Test\log\log.txt /
   appendToFile value=true /
   maxSizeRollBackups value=10 /
   maximumFileSize value=1024KB /
   rollingStyle value=Size /
   staticLogFileName value=true /
   layout type=log4net.Layout.PatternLayout
 conversionPattern value=%date [%thread] %-5level %logger 
[%ndc] - %message%newline /

   /layout
 /appender
 root
   level value=DEBUG /
   appender-ref ref=EventLogAppender /
 /root
 logger name= com.mypackage.test 
   level value=DEBUG /
   appender-ref ref=EventLogAppender /
 /logger
   /log4net

 Michael Schall escribió:

 Are any of the other appenders working(EventViewer, Console)? If not 
are you configuring log4net?  I see you have your configuration in 
your web config file.  We don't do it this way.


 If the others are working, it has to be in your config file or 
environment...


 We use external config files and configure it manually during 
Application_Start in the global.asax.  Below is a sample of our 
Web.log4net.config file.  This way we can change logging without 
resetting the web site.


 log4net

 appender name=RollingFile 
type=log4net.Appender.RollingFileAppender 

 file value=..\..\log\Regen.log /
 rollingStyle value=Composite /
 appendToFile value=false /
 datePattern value=MMdd /
 maximumFileSize value=100MB /
 maxSizeRollBackups value=-1 /
 StaticLogFileName value=false /
 layout type= log4net.Layout.PatternLayout
 conversionPattern value=%5level [%date] [%thread] 
%-30.30logger{2} %message%newline /

 /layout
 /appender

 appender name=EventLog type=log4net.Appender.EventLogAppender 
 applicationName value=Regen /
 filter type= log4net.Filter.LevelRangeFilter
 levelMin value=INFO /
 /filter
 layout type=log4net.Layout.PatternLayout 
 conversionPattern value=%logger %newline %message /
 /layout
 /appender

 root

 level value=DEBUG /
 appender-ref ref=RollingFile /
 appender-ref ref=EventLog /
 /root

 /log4net


 On 6/27/07, Samuel Rochas  [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:

 
  Dear Michael,
 
  I have changed my app to write a file using a TextWriter and this 
is working so I believe my app has rights to write files. But I still 
have the log problem, no log file is created.

 
  Do you have any 

Unsubcribe

2007-06-27 Thread Khalid, Amer
 

 



From: Alvaro Rozo [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 27, 2007 11:08 AM
To: Log4NET User
Subject: Re: no log file is created

 

Samuel,

 

I have not found an easy way to troubleshoot problems with Log4Net. I had 
issues in the past with it but the only real way was to step into the 
application's code and see where it was failing and what error was hopefully 
throwing. However, I must said that in the exact way as you, this was not the 
case many times as Log4Net decided to die silently without any notifications to 
event log or anything like it. That would be nice to have so we get some 
feedback but I have not found a way to do so yet. If you know let me know. 

 

The only thing that I could think of is right permissions to the folder. The 
ASP.NET impersonation needs to have read/write access to this physical folder 
(Windows Explorer). 

 

Other than that, I am afraid I do not have more to add.

 

Alvaro
 

On 6/27/07, Samuel Rochas [EMAIL PROTECTED] wrote: 

Dear Alvaro, 

I've changed my config according to yours but I still can't log. How could I 
try to troubleshoot?

Samuel

Alvaro Rozo escribió: 

Samuel,


Try the following, this works for me in my web.config:

?xml version=1.0?
configuration
configSections
section name=log4net type=log4net.Config 
.Log4NetConfigurationSectionHandler, log4net/
/configSections
More web config stuff
log4net
!-- RollingFileAppender looks after rolling over files by size 
or date --
appender name=RollingFileAppender 
type=log4net.Appender.RollingFileAppender
file value=C:\\Dev\\Test\\log\\log.txt/ 
param name=AppendToFile value=true/
param name=MaxSizeRollBackups value=10/
param name=MaximumFileSize value=10/ 
param name=RollingStyle value=Size/
param name=StaticLogFileName value=true/
layout type=log4net.Layout.PatternLayout 
param name=ConversionPattern value==%date 
[%thread] %-5level %logger [%ndc] - %message%newline/
/layout
/appender 
!-- Setup the root category, add the appenders and set the 
default level --
root
level value=DEBUG/
appender-ref ref=RollingFileAppender/ 
/root
/log4net
/configuration


On 6/27/07, Samuel Rochas  [EMAIL PROTECTED] mailto:[EMAIL 
PROTECTED]  wrote:
 
 Dear Michael, 
 
 I've tried to define an EventLogAppender as shown bellow, but still 
nothing happens. I may have a bigger problem ;-)
 In the Solution Explorer view, I can see the Bin directory with the 
log4net.dll inside, so for me it looks good.
 
 If I use an external config file for log4net, where do I tell my 
application to use it?
 
 Thanx
 Samuel
 
 web.config:
 configuration xmlns= 
http://schemas.microsoft.com/.NetConfiguration/v2.0;
   !-- Register a section handler for the log4net section -- 
   configSections 
 section name=log4net 
type=System.Configuration.IgnoreSectionHandler /
   /configSections
   appSettings
   /appSettings 
   !-- This section contains the log4net configuration settings -- 
   log4net
 !-- Define some output appenders --
 appender name=EventLogAppender type= 
log4net.Appender.EventLogAppender 
   layout type= log4net.Layout.PatternLayout
 conversionPattern value=%date [%thread] %-5level %logger 
[%property{NDC}] - %message%newline / 
   /layout
 /appender 
 appender name=A1 type=log4net.Appender.RollingFileAppender
   file value=C:\Dev\Test\log\log.txt / 
   appendToFile value=true / 
   maxSizeRollBackups value=10 /
   maximumFileSize value=1024KB /
   rollingStyle value=Size / 
   staticLogFileName value=true / 
   layout type=log4net.Layout.PatternLayout
 conversionPattern value=%date [%thread] %-5level %logger 
[%ndc] - %message%newline / 
   /layout 
 /appender
 root
   level value=DEBUG /
   appender-ref ref=EventLogAppender /
 /root 
 logger name= com.mypackage.test 
   level value=DEBUG /
   appender-ref ref=EventLogAppender /
 /logger
   /log4net
 
 Michael Schall escribió: 
 
 Are any of the other appenders working(EventViewer, Console)? If not 
are you configuring log4net?  I see you have your 

Re: no log file is created

2007-06-27 Thread Michael Schall

Put the following in your Application_Start in your Global.asax...

Dim applicationBase As String =
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase
Dim log4netPath As String = Path.Combine(applicationBase, 
Web.log4net.config)

If File.Exists(log4netPath) Then
   log4net.Config.XmlConfigurator.ConfigureAndWatch(NewFileInfo(log4netPath))
Else
   Throw New System.InvalidOperationException(Unable to find logging
configuration file at   log4netPath)
End If
Note that if this fails for some reason (file not present) or other
configuration issues, you will not have logging configured.  We kill the app
domain so that logging (and other configuration) is configured or the system
will not start up.

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
   Dim lg As ILogger = Nothing
   ...
   Try
   
   *Code above
   ...
*Catch ex As Exception
   Dim t As New Threading.Thread(AddressOf ShutdownApp)
   t.Start()
   Throw
   End Try
   ...
End Sub

Private Sub ShutdownApp()
   AppDomain.Unload(AppDomain.CurrentDomain)
End Sub
On 6/27/07, Samuel Rochas [EMAIL PROTECTED] wrote:


Dear Michael,

I've tried to define an EventLogAppender as shown bellow, but still
nothing happens. I may have a bigger problem ;-)
In the Solution Explorer view, I can see the Bin directory with the
log4net.dll inside, so for me it looks good.

If I use an external config file for log4net, where do I tell my
application to use it?

Thanx
Samuel

web.config:
configuration 
xmlns=http://schemas.microsoft.com/.NetConfiguration/v2.0;http://schemas.microsoft.com/.NetConfiguration/v2.0

  !-- Register a section handler for the log4net section --
  configSections
section name=log4net type=
System.Configuration.IgnoreSectionHandler /
  /configSections
  appSettings
  /appSettings
  !-- This section contains the log4net configuration settings --
  log4net
!-- Define some output appenders --
appender name=EventLogAppender type=
log4net.Appender.EventLogAppender 
  layout type=log4net.Layout.PatternLayout
conversionPattern value=%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline /
  /layout
/appender
appender name=A1 type=log4net.Appender.RollingFileAppender
  file value=C:\Dev\Test\log\log.txt /
  appendToFile value=true /
  maxSizeRollBackups value=10 /
  maximumFileSize value=1024KB /
  rollingStyle value=Size /
  staticLogFileName value=true /
  layout type=log4net.Layout.PatternLayout
conversionPattern value=%date [%thread] %-5level %logger [%ndc]
- %message%newline /
  /layout
/appender
root
  level value=DEBUG /
  appender-ref ref=EventLogAppender /
/root
logger name=com.mypackage.test 
  level value=DEBUG /
  appender-ref ref=EventLogAppender /
/logger
  /log4net

Michael Schall escribió:

Are any of the other appenders working(EventViewer, Console)? If not are
you configuring log4net?  I see you have your configuration in your web
config file.  We don't do it this way.

If the others are working, it has to be in your config file or
environment...

We use external config files and configure it manually during
Application_Start in the global.asax.  Below is a sample of our
Web.log4net.config file.  This way we can change logging without resetting
the web site.

log4net

appender name=RollingFile type=
log4net.Appender.RollingFileAppender
file value=..\..\log\Regen.log /
rollingStyle value=Composite /
appendToFile value=false /
datePattern value=MMdd /
maximumFileSize value=100MB /
maxSizeRollBackups value=-1 /
StaticLogFileName value=false /
layout type=log4net.Layout.PatternLayout
conversionPattern value=%5level [%date] [%thread] %-
30.30logger{2} %message%newline /
/layout
/appender

appender name=EventLog type=log4net.Appender.EventLogAppender 
applicationName value=Regen /
filter type=log4net.Filter.LevelRangeFilter
levelMin value=INFO /
/filter
layout type=log4net.Layout.PatternLayout 
conversionPattern value=%logger %newline %message /
/layout
/appender

root
level value=DEBUG /
appender-ref ref=RollingFile /
appender-ref ref=EventLog /
/root

/log4net

On 6/27/07, Samuel Rochas [EMAIL PROTECTED] wrote:

 Dear Michael,

 I have changed my app to write a file using a TextWriter and this is
 working so I believe my app has rights to write files. But I still have the
 log problem, no log file is created.

 Do you have any suggestion on what should I try now?

 Regards
 Samuel

 Michael Schall escribió:

 You don't need to escape them.  Here is my appender declaration...

 appender name=RollingFile type=
 log4net.Appender.RollingFileAppender
 file value=C:\Projects\Company_Name\Project_Name\log\web.log
 /
 appendToFile value=true /
   

Re: Path Sentinels

2007-06-27 Thread Ron Grabowski
This will print out a list of available environment variables:



log.Info(Environment.GetEnvironmentVariables());



- Original Message 

From: Vanderkolk, John [EMAIL PROTECTED]

To: Log4NET User log4net-user@logging.apache.org

Sent: Wednesday, June 27, 2007 10:10:31 AM

Subject: Path Sentinels



Path Sentinels   Hello all, 

  I know that ${TMP} is valid and evaluates to the user's temp directory when 
used in the config file for a location of a file appender. What is/where can I 
find a list of all such sentinels I might be able to use, and is there a way of 
knowing which of them will be able to be accessed be ASPNET user by default 
without testing them all?

  John VanderKolk  

[EMAIL PROTECTED] 

  

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.









Re: no log file is created

2007-06-27 Thread Ron Grabowski
I'd recommend starting with an appender that does not write any files to verify 
that log4net is starting correctly. ConsoleAppender and/or the 
AspNetTraceAppender are good canidates.

- Original Message 
From: Samuel Rochas [EMAIL PROTECTED]
To: log4net-user@logging.apache.org
Sent: Thursday, June 21, 2007 11:54:56 AM
Subject: no log file is created

Dear all,

I use to work with Log4j but I am new to Log4net. I try to setup a small 
example but no file is created while logging, though the line with the 
log instruction is executed. This is my setup, any hint? Thank you in 
advance.

*** web.config ***
configuration
  !-- Register a section handler for the log4net section --
  configSections
section name=log4net 
type=System.Configuration.IgnoreSectionHandler /
  /configSections
  appSettings
!-- To enable internal log4net logging specify the following 
appSettings key --
!-- add key=log4net.Internal.Debug value=true/ --
  /appSettings
  !-- This section contains the log4net configuration settings --
  log4net
!-- Define some output appenders --
appender name=A1 type=log4net.Appender.RollingFileAppender
  file value=log.txt /
  appendToFile value=true /
  maxSizeRollBackups value=10 /
  maximumFileSize value=1024KB /
  rollingStyle value=Size /
  staticLogFileName value=true /
  layout type=log4net.Layout.PatternLayout
!--
header value=[Header]#13;#10; /
footer value=[Footer]#13;#10; /--
conversionPattern value=%date [%thread] %-5level %logger 
[%ndc] - %message%newline /
  /layout
/appender
root
  level value=DEBUG /
  appender-ref ref=A1 /
/root
logger name =L1
  level value=DEBUG /
  appender-ref ref=A1 /
/logger
  /log4net
*

*** My code ***
public static class Query
{
// Logger instance
private static readonly ILog log = 
LogManager.GetLogger(typeof(Query));

public static ArrayList myMethod(string id_p, string course_p)
{
 log.Debug(Entering application.);


*






Re: no log file is created

2007-06-27 Thread Ron Grabowski

Are you capturing log4net's internal error messages to see why its dying? Its 
possible to capture internal errors and redirect them to 
System.Diagnostics.Trace, send an email, etc.


- Original Message 

From: Alvaro Rozo [EMAIL PROTECTED]

To: Log4NET User log4net-user@logging.apache.org

Sent: Wednesday, June 27, 2007 12:07:39 PM

Subject: Re: no log file is created



Samuel,

  

 I have not found an easy way to troubleshoot problems with Log4Net. I had 
issues in the past with it but the only real way was to step into the 
application's code and see where it was failing and what error was hopefully 
throwing. However, I must said that in the exact way as you, this was not the 
case many times as Log4Net decided to die silently without any notifications to 
event log or anything like it. That would be nice to have so we get some 
feedback but I have not found a way to do so yet. If you know let me know. 

  

 The only thing that I could think of is right permissions to the folder. The 
ASP.NET impersonation needs to have read/write access to this physical folder 
(Windows Explorer). 

  

 Other than that, I am afraid I do not have more to add.

  

 Alvaro

 

 On 6/27/07, Samuel Rochas [EMAIL PROTECTED] wrote:  Dear Alvaro, 



I've changed my config according to yours but I still can't log. How could I 
try to troubleshoot?



Samuel



Alvaro Rozo escribió:Samuel,

 

Try the following, this works for me in my web.config:



?xml version=1.0?

configuration

configSections

section name=log4net type=log4net.Config  
.Log4NetConfigurationSectionHandler, log4net/

/configSections

More web config stuff

log4net

 !-- RollingFileAppender looks after rolling over files by size or 
date --

appender name=RollingFileAppender 
type=log4net.Appender.RollingFileAppender

file value=C:\\Dev\\Test\\log\\log.txt/  

param name=AppendToFile value=true/

param name=MaxSizeRollBackups value=10/

param name=MaximumFileSize value=10/  

param name=RollingStyle value=Size/

param name=StaticLogFileName value=true/

layout type=log4net.Layout.PatternLayout  

param name=ConversionPattern value==%date [%thread] 
%-5level %logger [%ndc] - %message%newline/

/layout

/appender  

!-- Setup the root category, add the appenders and set the default 
level --

root

level value=DEBUG/

appender-ref ref=RollingFileAppender/  

/root

/log4net

/configuration





On 6/27/07, Samuel Rochas  [EMAIL PROTECTED] wrote:

 

 Dear Michael, 

 

 I've tried to define an EventLogAppender as shown bellow, but still nothing 
 happens. I may have a bigger problem ;-)

 In the Solution Explorer view, I can see the Bin directory with the  
 log4net.dll inside, so for me it looks good.

 

 If I use an external config file for log4net, where do I tell my application 
 to use it?

 

 Thanx

 Samuel

 

 web.config:

 configuration xmlns=  http://schemas.microsoft.com/.NetConfiguration/v2.0;;

   !-- Register a section handler for the log4net section -- 

   configSections 

 section name=log4net type=System.Configuration.IgnoreSectionHandler 
 /

   /configSections

   appSettings

   /appSettings 

   !-- This section contains the log4net configuration settings -- 

   log4net

 !-- Define some output appenders --

 appender name=EventLogAppender type= 
 log4net.Appender.EventLogAppender 

   layout type= log4net.Layout.PatternLayout

 conversionPattern value=%date [%thread] %-5level %logger 
 [%property{NDC}] - %message%newline / 

   /layout

 /appender 

 appender name=A1 type=log4net.Appender.RollingFileAppender

   file value=C:\Dev\Test\log\log.txt / 

   appendToFile value=true / 

   maxSizeRollBackups value=10 /

   maximumFileSize value=1024KB /

   rollingStyle value=Size / 

   staticLogFileName value=true / 

   layout type=log4net.Layout.PatternLayout

 conversionPattern value=%date [%thread] %-5level %logger [%ndc] - 
 %message%newline / 

   /layout 

 /appender

 root

   level value=DEBUG /

   appender-ref ref=EventLogAppender /

 /root 

 logger name= com.mypackage.test 

   level value=DEBUG /

   appender-ref ref=EventLogAppender /

 /logger

/log4net

 

 Michael Schall escribió: 

 

 Are any of the other appenders working(EventViewer, Console)? If not are you 
 configuring log4net?  I see you have your configuration in your web config 
 file.  We don't do it this way.  

 

 If the others are working, it has to be in your config file or environment... 

 

 We use external config files and configure it manually during 
 Application_Start in the global.asax.  Below is a sample of our  
 Web.log4net.config file.  This way we can change logging without resetting 
 the web site. 

 

 

Re: Unsubcribe

2007-06-27 Thread Erik Brooks

On 6/27/07, Khalid, Amer [EMAIL PROTECTED] wrote:









 


From: Alvaro Rozo [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 27, 2007 11:08 AM
 To: Log4NET User
 Subject: Re: no log file is created




Samuel,





I have not found an easy way to troubleshoot problems with Log4Net. I had
issues in the past with it but the only real way was to step into the
application's code and see where it was failing and what error was hopefully
throwing. However, I must said that in the exact way as you, this was not
the case many times as Log4Net decided to die silently without any
notifications to event log or anything like it. That would be nice to have
so we get some feedback but I have not found a way to do so yet. If you know
let me know.





The only thing that I could think of is right permissions to the folder. The
ASP.NET impersonation needs to have read/write access to this physical
folder (Windows Explorer).





Other than that, I am afraid I do not have more to add.





Alvaro



On 6/27/07, Samuel Rochas [EMAIL PROTECTED] wrote:


Dear Alvaro,

 I've changed my config according to yours but I still can't log. How could
I try to troubleshoot?

 Samuel

 Alvaro Rozo escribió:




Samuel,



 Try the following, this works for me in my web.config:

 ?xml version=1.0?
 configuration
 configSections
 section name=log4net type=log4net.Config
.Log4NetConfigurationSectionHandler, log4net/
 /configSections
 More web config stuff
 log4net
 !-- RollingFileAppender looks after rolling over files by size or
date --
 appender name=RollingFileAppender
type=log4net.Appender.RollingFileAppender
 file value=C:\\Dev\\Test\\log\\log.txt/
 param name=AppendToFile value=true/
 param name=MaxSizeRollBackups value=10/
 param name=MaximumFileSize value=10/
 param name=RollingStyle value=Size/
 param name=StaticLogFileName value=true/
 layout type=log4net.Layout.PatternLayout 
 param name=ConversionPattern value==%date [%thread]
%-5level %logger [%ndc] - %message%newline/
 /layout
 /appender
 !-- Setup the root category, add the appenders and set the default
level --
 root
 level value=DEBUG/
 appender-ref ref=RollingFileAppender/
 /root
 /log4net
 /configuration


 On 6/27/07, Samuel Rochas  [EMAIL PROTECTED] wrote:
 
  Dear Michael,
 
  I've tried to define an EventLogAppender as shown bellow, but still
nothing happens. I may have a bigger problem ;-)
  In the Solution Explorer view, I can see the Bin directory with the
log4net.dll inside, so for me it looks good.
 
  If I use an external config file for log4net, where do I tell my
application to use it?
 
  Thanx
  Samuel
 
  web.config:
  configuration xmlns=
http://schemas.microsoft.com/.NetConfiguration/v2.0;
!-- Register a section handler for the log4net section --
configSections
  section name=log4net
type=System.Configuration.IgnoreSectionHandler /
/configSections
appSettings
/appSettings
!-- This section contains the log4net configuration settings --
log4net
  !-- Define some output appenders --
  appender name=EventLogAppender type=
log4net.Appender.EventLogAppender 
layout type= log4net.Layout.PatternLayout
  conversionPattern value=%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline /
/layout
  /appender
  appender name=A1
type=log4net.Appender.RollingFileAppender
file value=C:\Dev\Test\log\log.txt /
appendToFile value=true /
maxSizeRollBackups value=10 /
maximumFileSize value=1024KB /
rollingStyle value=Size /
staticLogFileName value=true /
layout type=log4net.Layout.PatternLayout
  conversionPattern value=%date [%thread] %-5level %logger [%ndc]
- %message%newline /
/layout
  /appender
  root
level value=DEBUG /
appender-ref ref=EventLogAppender /
  /root
  logger name= com.mypackage.test 
level value=DEBUG /
appender-ref ref=EventLogAppender /
  /logger
/log4net
 
  Michael Schall escribió:
 
  Are any of the other appenders working(EventViewer, Console)? If not are
you configuring log4net?  I see you have your configuration in your web
config file.  We don't do it this way.
 
  If the others are working, it has to be in your config file or
environment...
 
  We use external config files and configure it manually during
Application_Start in the global.asax.  Below is a sample of our
Web.log4net.config file.  This way we can change logging without resetting
the web site.
 
  log4net
 
  appender name=RollingFile
type=log4net.Appender.RollingFileAppender 
  file value=..\..\log\Regen.log /
  rollingStyle value=Composite /
  appendToFile value=false /
  datePattern value=MMdd