on 06-30-2021 9:18 AM
Is it possible to change the log level of a SAP CAP Application with environment variables?
Hi kai.niklas86 ,
Yes, you can set the log levels. (Currently in beta)
You can set
cds.env["log-level"] = 'info' / 'error' / 'warning'
as well as the environment variable DEBUG to either 'y' or 'all' or a certain module (e.g. 'sqlite').
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does this answer refer to the build option --log-level? If yes, then this is not exactly what I am looking for. I am looking for a generic log level while running the application, so that not each and every GET request gets logged.
Further, I opt for setting the log level to WARNING or ERROR in NODE_ENV=production as default.
Hi kai.niklas86 ,
Per default, we use `console.log` but you can plug whatever logger you want:
cds.log.Logger = (module, level, prefix) => {
const logger = winston.createLogger(...)
Object.assign(logger, {
level,
_trace: false,
_debug: false,
_info: false,
_warn: true,
_error: true
})
return logger
}
Here you can also define the log level.
Best regards,
David
Hi ramondb ,
I think you need to use the environment variable DEBUG.
Best regards,
David
User | Count |
---|---|
65 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.