Fl4m3Ph03n1x
Background
In one of our projects a client of ours complained that the logs he is getting are being capped at 2000 characters.
This client is gettign his logs via a tool called Splunk and perhaps some other systems I am not aware of.
Instead of capping the messages at 2K characters, I need to cap them at 8K.
Config
To me this is strange, because we specifically truncate the log to :infinity, as our config shows:
use Mix.Config
config :logger,
level: :info,
backends: [:console],
utc_log: true,
sync_threshold: 100,
truncate: :infinity
if Mix.env() != :prod do
config :logger,
level: :debug
end
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [
:module,
:line,
:function,
:trace,
:perf,
:duration,
:namespace
]
Furthermore, I didn’t find any specific Logger limits documented:
Question
- Does the Logger have some internal limit that cuts messages down to 2000 characters? If so, how can I change it?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kip
At least on the console backend I’m not seeing such a limit. You can test it easily with:
kip
Just for giggles I put it in a test case:
And ran the test:
Fl4m3Ph03n1x
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.
Once again thank you!
NobbZ
Is it perhaps the
:truncateoption? By default it’s 8kiB.al2o3cr
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…KristerV
just so my headache is logged somewhere.
there’s two different layers you can config in the logger. one for backends, one for logger itself. so in my case this helper a lot:
thanks goes to @JonRowe and @LostKobrakai in Slack.
mxgrn
Apparently, the first line is enough. So happy to have found it
c4710n
Updates that fit the current situation:
disable log truncation
As of Elixir 1.14:
config :logger, truncate: :infinityis enough for disabling log truncation.log data
Another point to note if you are planing to print data with
inspect/2:Make sure that inspect will print all the information you want. The following line is a good start:
performance consideration
If the data is large, carefully consider before using the above two steps.
rlopzc
To enable infinite truncation in the new Logger (since Elixir 1.15) do:
ydg33
For future reference: I added
config :logger, :default_formatter, truncate: :infinitytoconfig/config.exsin Phoenix and this additionallyconfig/dev.exs… so I ended up having to remove it. I wish there were more documentation on this.