Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.log is also including access logs #3

Open
anperez78 opened this issue Aug 25, 2015 · 2 comments
Open

app.log is also including access logs #3

anperez78 opened this issue Aug 25, 2015 · 2 comments

Comments

@anperez78
Copy link

No description provided.

@dehlen
Copy link

dehlen commented Feb 29, 2016

I am having the same problem. Any idea how to change the configuration so this won't happen ?

@anperez78
Copy link
Author

Basically you can have two appenders, one for application logs and another one for access logs. Then just exclude application from access logs (category 'http'):

                {
                    "type": "dateFile",
                    "filename": config.server.logs.accessLogs.filename,
                    "pattern": "-yyyy-MM-dd",
                    "layout": {"type": "messagePassThrough"},
                    "category": "http"
                },
                {
                    "type": "categoryFilter",
                    "exclude": ["http"],
                    "appender": {
                        "type": "dateFile",
                        "filename": config.server.logs.applicationLogs.filename,
                        "pattern": "-yyyy-MM-dd",
                        "layout": {
                            "type": "pattern",
                            "pattern": commonPattern,
                            "tokens": commonPatternTokens
                        }
                    }
                }

Then you need to set an specific connector for those access logs:

app.use(log4js.connectLogger(log4js.getLogger('http'), { level: 'auto', format: config.server.logs.accessLogs.pattern }))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants