Does anyone had the luck to have this configured correctly?
- Created an account on MongoHQ
- Added a new user to the database
- Created a new Collection named
logs_net - Added log4mongo-net library
- Added the configuration to the
web.config
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
and
<log4net>
<appender name="MongoAppender" type="log4net.Appender.MongoDBAppender, log4mongo-net">
<!-- MongoDB connection options -->
<host value="staff.mongohq.com" />
<port value="10048" />
<databaseName value="d1741d63-46b1-4a44-9c21-8a85cecae45b" />
<collectionName value="logs_net" />
<userName value="balexandre" />
<password value="myPassWorD" />
</appender>
- Added
log4net.Config.XmlConfigurator.Configure();toglobal.asaxunderApplication_Start()
and added some info:
ILog logger = LogManager.GetLogger(this.GetType());
logger.Info("MainController Initialize test");
And… I can’t get logs into MongoDB, any help?
By the way, the Database name is not the correct one, neither the password, and if I use log4net.Appender.RollingFileAppender it works great.
I suggest turning on internal debugging, this should reveal what is going wrong. It is quite possible that the log4mongo assembly is not loaded correctly. Are you sure it is copied (with all dependencies) to the bin folder?