Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:Ledest:erlang:24
erlang
4471-logger-Print-to-stderr-if-printing-to-stdo...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4471-logger-Print-to-stderr-if-printing-to-stdout-failed.patch of Package erlang
From 328b55c9c1706f7e4cf2c76a449d1fd1b0240c18 Mon Sep 17 00:00:00 2001 From: Lukas Larsson <lukas@erlang.org> Date: Fri, 10 Jun 2022 15:57:50 +0200 Subject: [PATCH] logger: Print to stderr if printing to stdout failed If we cannot print to standard_io we try to instead print to standard_error just to make sure that the error log message is printed. We know that group_leader will always point to the kernel application master and thus we will be forwarded to 'user' eventutally, so we can short circuit there. As a bonus we also now get to know if user or user_drv has crashed and the io:put_chars call can fail. --- lib/kernel/src/logger_std_h.erl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/kernel/src/logger_std_h.erl b/lib/kernel/src/logger_std_h.erl index 1fe740d5ec..1b2fabad72 100644 --- a/lib/kernel/src/logger_std_h.erl +++ b/lib/kernel/src/logger_std_h.erl @@ -507,6 +507,15 @@ ensure_open(Filename, Modes) -> exit({could_not_create_dir_for_file,Error}) end. +write_to_dev(Bin,#{dev:=standard_io}=State) -> + try + io:put_chars(user, Bin) + catch _E:_R -> + io:put_chars( + standard_error, "Failed to write log message to stdout, trying stderr\n"), + io:put_chars(standard_error, Bin) + end, + State; write_to_dev(Bin,#{dev:=DevName}=State) -> io:put_chars(DevName, Bin), State; -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor