Using Log4Net From 2 Process

R

Ram

Hey,
I'm using the Log4Net opensource object to write to my logs.
I'v written a wrapper ClassLibrary project for the Log4Net and all my
projects reference only to it.
I'v got a web application thats calls a com+ application (- another
project of mine that is in the same solution) and I want both of this
"layers" to use my Log4Net Wrapper, and - here comes the tricky part -
write to the same Log file.
When the Com+ application is set to work as Library, all is well, but
when the Com+ is set to run as "server", when I try to write to the
log from the Com+ (AFTER already writing throw the ASP_Net) I get an
exception from the log4net saying: "The Process Cant Access The File
<the log file> Because It Is Being Used By Another Process"
 
M

Martin Higgins

Hey,
I'm using the Log4Net opensource object to write to my logs.
I'v written a wrapper ClassLibrary project for the Log4Net and all my
projects reference only to it.
I'v got a web application thats calls a com+ application (- another
project of mine that is in the same solution) and I want both of this
"layers" to use my Log4Net Wrapper, and - here comes the tricky part -
write to the same Log file.
When the Com+ application is set to work as Library, all is well, but
when the Com+ is set to run as "server", when I try to write to the
log from the Com+ (AFTER already writing throw the ASP_Net) I get an
exception from the log4net saying: "The Process Cant Access The File
<the log file> Because It Is Being Used By Another Process"

FileAppender requires a write lock on the log file. The FAQ gives a
workaround, although your performance will probably suffer if you use
it:

"You may have each process log to a RemotingAppender. The receiving
RemoteLoggingServerPlugin (or IRemoteLoggingSink) can receive all the
events and send them to a single log file."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top