SilverBlaZe
SilverBlaZe

Reputation: 65

Can two separate lager sinks log in to same file?

So I am using lager for logging and trying to achieve a particular scenario here

Currently we have single lager sink for our erlang project which has multiple apps and now we want per-app lager sink, but we don't want to break the logs into multiple files also. Is this achievable? Can two lager sinks log into same file for example (same debug.log for all app sinks) and if yes are there any limitations to it?

Upvotes: 0

Views: 121

Answers (1)

Andrew Thompsno
Andrew Thompsno

Reputation: 1

Lager author here. You likely cannot point multiple sinks at the same file, because the sink opens the file in raw mode, so you can't write to it from a different process. Trying to do so will probably either fail or randomly interleave writes from both sinks (or corrupt the file).

However, I didn't write the multiple sink stuff, and I've never really used it. Why do you want to do this, maybe there's a simpler way to achieve what you want?

Upvotes: 0

Related Questions