defmodule ThingTest do
use ExUnit.Case
import ExUnit.CaptureLog
require Logger
@message_size 8_000
test "Logger backend end" do
assert capture_log(fn -> Logger.error(String.duplicate("A", @message_size)) end) >= @message_size
end
end
And ran the test:
kip@Kips-iMac-Pro thing % mix test
.
Finished in 0.04 seconds
1 test, 0 failures
Thanks for the super quick answer!
I have made the test you have mentioned in the first post and concluded that it is very unlikely for the issue to be in the Elixir code we have.
Is it perhaps the :truncate option? By default it’s 8kiB.
:truncate - the maximum message size to be logged (in bytes). Defaults to 8192 bytes. Note this configuration is approximate. Truncated messages will have " (truncated)" at the end. The atom :infinity can be passed to disable this behavior.
FWIW there is a limiter (see @NobbZ’s post) but there can also be intermediate steps that trim things shorter - at work, lines long enough to hit Logger’s limit (and get (truncated) at the end) are still split into multiple lines someplace between Logger -> syslog -> CloudWatch. Not sure what specifically is causing that…