-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
fixed:Log level does not work on V2 logs #4300
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
Changes from 1 commit
dfd771a
84d5372
1ca51c1
821f39c
b46fec7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
const char* srs_log_level_strings[] = { | ||
#ifdef SRS_LOG_LEVEL_V2 | ||
// The v2 log level specs by log4j. | ||
"FORB", "TRACE", "DEBUG", NULL, "INFO", NULL, NULL, NULL, | ||
"FORB", "VERB", "TRACE", "DEBUG", "INFO", NULL, NULL, NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels/2031209#2031209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
"WARN", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
"ERROR", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,20 +20,36 @@ | |
|
||
// The log level, see https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-api/src/main/java/org/apache/logging/log4j/Level.java | ||
// Please note that the enum name might not be the string, to keep compatible with previous definition. | ||
#ifdef SRS_LOG_LEVEL_V2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
enum SrsLogLevel | ||
{ | ||
SrsLogLevelForbidden = 0x00, | ||
|
||
// Only used for very verbose debug, generally, | ||
// we compile without this level for high performance. | ||
SrsLogLevelForbidden = 0x00, | ||
//v2 type | ||
SrsLogLevelVerbose = 0x01, | ||
SrsLogLevelInfo = 0x02, | ||
SrsLogLevelTrace = 0x04, | ||
SrsLogLevelTrace = 0x02, | ||
SrsLogLevelDebug = 0x03, | ||
SrsLogLevelInfo = 0x04, | ||
SrsLogLevelWarn = 0x08, | ||
SrsLogLevelError = 0x10, | ||
|
||
SrsLogLevelDisabled = 0x20, | ||
SrsLogLevelDisabled = 0x20, | ||
}; | ||
#else | ||
enum SrsLogLevel | ||
{ | ||
SrsLogLevelForbidden = 0x00, | ||
|
||
// Only used for very verbose debug, generally, | ||
// we compile without this level for high performance. | ||
SrsLogLevelVerbose = 0x01, | ||
SrsLogLevelInfo = 0x02, | ||
SrsLogLevelTrace = 0x04, | ||
SrsLogLevelWarn = 0x08, | ||
SrsLogLevelError = 0x10, | ||
|
||
SrsLogLevelDisabled = 0x20, | ||
}; | ||
#endif | ||
|
||
// Get the level in string. | ||
extern const char* srs_log_level_strings[]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR don't make sense.
The SRS_LOG_LEVEL_V2 is enabled by default.
srs/trunk/auto/options.sh
Line 71 in 93cba24
The
SRS_LOG_LEVEL_V2
, which means the log level names defined in https://github.com/apache/logging-log4j2/blob/2.x/log4j-api/src/main/java/org/apache/logging/log4j/Level.javaor
https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels/2031209#2031209
This func is just a bridge between log level enum, defined by SRS, and
srs.conf
. So it's not necessary to redefine anotherSrsLogLevelXXX
for log level 2.The only fault of this func is log level
fatal
is missing, which can be mapping toSrsLogLevelError
anyway.If the
level
string are upper cases, thesrs.conf
and Unit test cases need to change to match this change, so I don't think its a good idea also.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.o,it different from the documentation

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upper cases terms, TRACE, DEBUG, INFO, WARN, ERROR, are print to logs, not the configurable claims, use lower-cases in conf file.