Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mixing log4cxx and log4net

I have a c++ application which logs to some file using log4cxx (RollingFile appender). I want to log into the same file, at the same time, from another module written in c#; so i configured log4net to use the same file, but i can't get the new messages in. If i deactivate the c++ logging, i can see c# messages. So i think it is a locking issue, and looked for a configuration option to tell log4cxx not to lock the file. I came into MinimalLock model for log4net, but couldn't find anything in log4cxx... does anybody know if it could be done, and how?

thanks in advance,

Ernesto Cullen

like image 354
user25800 Avatar asked Oct 21 '08 12:10

user25800


People also ask

How do I use multiple Appenders in log4net?

You can't log to separate appenders - you need to configure different loggers, and attach the appropriate appender to each one. Then log different messages to the different loggers.


1 Answers

I think that you might run into concurrency and contention problems no matter what configuration you use as long as you are attempting to have two different processes log to the same file.

You should look into sending log events from both processes to a third, centralized location - take a look at RemotingAppender in log4net, I assume log4cxx has something similar.

like image 147
matt b Avatar answered Sep 27 '22 23:09

matt b