Closed loguntsov closed 7 years ago
I have custom ejabberd with lager 3.2.0
It's possible there's an error in the parse transformation code (assuming you're using parse transformation), but do you have traces defined for the sink?
That makes log dispatch bypass the filtering to drop messages that don't match the severity levels.
Yes. I'm using parse transform for lager. So what i should check from my side? How i can give you traces ?
by the way, i have manual way (via makefile) to compile ejabberd code with lager parse_tranform without rebar, and my compilation commands are like that:
/usr/local/bin/erlc -W -DSSL40 -I .. -I ../../include -pa ../../deps/lager/ebin/ -pz .. -o .. ejabberd_http_bind.erl
May i should use some options of compilation ?
Version of erlang is 18.3
Thanks.
I am talking about lager-specific "traces" that might be part of your lager configuration. What does your app.config
file look like for lager?
I'm using dinamyc configuration of lager. No any traces. Just
ConsoleLog = get_log_path(),
?INFO_MSG("Ejabberd's log is ~p~n", [ ConsoleLog ]),
Dir = filename:dirname(ConsoleLog),
Format = [ time, " [", severity, "]",
{user, ["[u_", user, "]"], ""},
{user_from, ["[u_", user_from, "f]"], ""},
{user_to, ["[u_", user_to, "t]"], ""},
{pid, [ pid ], ""},
"[",
{module, [
module,
{function, [":", function], ""},
{line, [":",line], ""}
], "" }, "] ",
message, "\n\n"
],
FileFormat = [ date, " " ] ++ Format,
ErrorLog = filename:join([Dir, "error.log"]),
CrashLog = filename:join([Dir, "crash.log"]),
LogRotateDate = get_string_env(log_rotate_date, ""),
LogRotateSize = get_integer_env(log_rotate_size, 1000*1024*1024), %% 1 Gb of log.
LogRotateCount = get_integer_env(log_rotate_count, 5),
LogRateLimit = get_integer_env(log_rate_limit, 100),
application:set_env(lager, error_logger_hwm, LogRateLimit),
application:set_env(lager, handlers, [
{lager_console_backend, info},
{lager_file_backend, [
{file, ConsoleLog},
{level, info},
{date, LogRotateDate},
{count, LogRotateCount},
{size, LogRotateSize},
{formatter,lager_default_formatter},
{formatter_config,FileFormat}
]},
{lager_file_backend, [
{file, ErrorLog},
{level, error},
{date, LogRotateDate},
{count, LogRotateCount},
{size, LogRotateSize},
{formatter,lager_default_formatter},
{formatter_config,FileFormat}
]}
]),
application:set_env(lager, crash_log, CrashLog),
application:set_env(lager, crash_log_date, LogRotateDate),
application:set_env(lager, crash_log_size, LogRotateSize),
application:set_env(lager, crash_log_count, LogRotateCount),
application:set_env(lager, log_root, "/var/log/ejabberd"),
and changing log level dynamically:
lists:foreach(
fun({lager_file_backend, File} = H) when File == ConsoleLog ->
lager:set_loglevel(H, LagerLogLevel);
(lager_console_backend = H) ->
lager:set_loglevel(H, LagerLogLevel);
(_) ->
ok
end, gen_event:which_handlers(lager_event))
And yes, this code can be not good to change loglevel. Is there standard way to change minimal loglevel for ALL backends ? Because now we have other backends for lager and needs support them inside code above.
Now i think no issue inside lager. It is problem of our code. Thanks. Pls close this topic.
I'm using lager and testing on high load with tsung.
I have many messages in message queue of default sink: I have loglevel as WARNING. And i see right behaviour in my log files. Have no tons messages in my log-files. But all messages (see below) from message queue are INFO level, and this situation need CPU and memory from machine to process them.
So i can decide that basic feature:
are broken or was implemented not right.
Please, could you explain me where i'm wrong ?
Thanks.