Package org.log4mongo

Examples of org.log4mongo.MongoDbAppender


    private void setMongoInfoByLog4j(Project project) {
        Enumeration appenders = Logger.getRootLogger().getAllAppenders();
        while (appenders.hasMoreElements()) {
            Object appender = appenders.nextElement();
            if (appender instanceof MongoDbAppender) {
              MongoDbAppender ref = (MongoDbAppender) appender;
                project.setLogCollection(ref.getCollectionName());
                project.setMongoUri(String.format("mongodb://%s:%s/%s",
                    ref.getHostname(), ref.getPort(), ref.getDatabaseName()));
            }
            if (appender instanceof AsynMongoURILayoutAppender) {
              AsynMongoURILayoutAppender ref = (AsynMongoURILayoutAppender) appender;
                project.setLogCollection(ref.getCollectionName());
                project.setMongoUri(ref.getMongoURI());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.log4mongo.MongoDbAppender

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.