logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy Chastain" <...@roychastain.org>
Subject RE: log4net for .NET 4.0 / Windows 7
Date Fri, 27 May 2011 11:38:12 GMT
Look at http://stackoverflow.com/questions/468989/how-to-specify-common-application-data-folder-for-log4net
And http://logging.apache.org/log4net/release/config-examples.html

And you will see the syntax in the file path is ${variablename}  where variable name is any
(I THINK ANY) environment variable.

Type SET in a Command Prompt to see what variables are defined and which one gets to your
private appdata directory.  APPDATA or LOCALAPPDATA are probably what you are looking for.

----------------------------------------------------------------------
Roy Chastain




-----Original Message-----
From: Monish Naware [mailto:Monish.Naware@mphasis.com] 
Sent: Friday, May 27, 2011 07:21
To: Log4NET User
Subject: RE: log4net for .NET 4.0 / Windows 7

Roy, I agree to you!
But then what should be the parameter in the config file (for file attribute) to get the current
user's program directory?

Monish.

-----Original Message-----
From: Roy Chastain [mailto:Roy@roychastain.org] 
Sent: Friday, May 27, 2011 4:31 PM
To: Log4NET User
Subject: RE: log4net for .NET 4.0 / Windows 7

You SHOULD NOT be writing logs to installation directories.  They should be placed in the
user  program data directory.  If memory serves, log4Net has a "reserved" word for that directory
that you can use in the configuration.

ProgramFiles etc are write protected for a reason and you should not unprotect it or any part
to all writing the log.  That just give malware one more avenue of attack.

----------------------------------------------------------------------
Roy Chastain




-----Original Message-----
From: Monish Naware [mailto:Monish.Naware@mphasis.com] 
Sent: Friday, May 27, 2011 06:54
To: Log4NET User
Subject: RE: log4net for .NET 4.0 / Windows 7


Here I found something... Log file is getting generated but not where I mentioned! The file
is getting created where the excel application is i.e. C:\Program Files\Microsoft Office\Office
14. But I want the log file to be generated where my addin is installed i.e. C:\Program Files\MyAddin\....
Below is the config file of my application:

<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">

		<file value="MyLog.log" />

		<appendToFile value="true" />

		<rollingStyle value="Size" />

		<maxSizeRollBackups value="10" />

		<maximumFileSize value="2000KB" />

		<immediateFlush value="false" />

		<layout type="log4net.Layout.PatternLayout">

		        <conversionPattern value="%date [%thread] %-5level %logger -    %message%newline"
/>

		</layout>

</appender>

I even tried:

		<file value=".\MyLog.log" /> Thought this will point to the directory where my addin
is installed.

Thanks,

Monish.



-----Original Message-----
From: Radovan Raszka [mailto:raszka@hasam.cz]
Sent: Friday, May 27, 2011 1:43 PM
To: Log4NET User
Subject: RE: log4net for .NET 4.0 / Windows 7

Also check if your application references Full .Net4.0, not only Client profile .Net4.0

Radovan

-----Původní zpráva-----

Od: Monish Naware [mailto:Monish.Naware@mphasis.com] 

Odesláno: 26. května 2011 14:02

Komu: Log4NET User

Předmět: RE: log4net for .NET 4.0 / Windows 7

Thanks, I will try these things.

Monish.

-----Original Message-----

From: Dean Fiala [mailto:dfiala@gmail.com]

Sent: Thursday, May 26, 2011 5:27 PM

To: Log4NET User

Subject: Re: log4net for .NET 4.0 / Windows 7

Excel probably runs as you unless you are doing something truly strange.

Things I'd try...

1) writing the log to another location

2) turning on the log4net debugging and see what it coughs up in the debug output


Information transmitted by this e-mail is proprietary to MphasiS, its associated companies
and/ or its customers and is intended for use only by the individual or entity to which it
is addressed, and may contain information that is privileged, confidential or exempt from
disclosure under applicable law. If you are not the intended recipient or it appears that
this mail has been forwarded to you without proper authority, you are notified that any use
or dissemination of this information in any manner is strictly prohibited. In such cases,
please notify us immediately at mailmaster@mphasis.com and delete this mail from your records.

Information transmitted by this e-mail is proprietary to MphasiS, its associated companies
and/ or its customers and is intended 
for use only by the individual or entity to which it is addressed, and may contain information
that is privileged, confidential or 
exempt from disclosure under applicable law. If you are not the intended recipient or it appears
that this mail has been forwarded 
to you without proper authority, you are notified that any use or dissemination of this information
in any manner is strictly 
prohibited. In such cases, please notify us immediately at mailmaster@mphasis.com and delete
this mail from your records.


Mime
View raw message