Commit graph

11 commits

Author SHA1 Message Date
Nobuyoshi Nakada
edd3977b40 [ruby/logger] Enable log file rotation on Windows
Since ruby 2.3, a file opened with `File::SHARE_DELETE` and
`File::BINARY` can be renamed or removed.

7b6146fee6
2024-12-04 07:45:39 +00:00
Nobuyoshi Nakada
ed47b6b324 [ruby/logger] Extract Logger::LogDevice#handle_write_errors
f904ad2f7c
2024-12-04 07:45:37 +00:00
Jeremy Evans
c698180e68 [ruby/logger] Add reraise_write_errors keyword argument to Logger and LogDevice
This allows the user to specify exception classes to treat as regular
exceptions instead of being swallowed.  Among other things, it is
useful for having Logger work with Timeout.

Fixes Ruby Bug 9115.

436a7d680f
2024-07-11 15:25:17 +00:00
Samuel Williams
7ab4820af7 [ruby/logger] Only assign to @filename if the path is valid.
(https://github.com/ruby/logger/pull/81)

b41d7c699c
2022-12-08 03:28:18 +00:00
Jesse Chavez
99d02caed3 [ruby/logger] Fix log rotation inter-process lock failed.
Issue only occurs in JRuby 9.3.0.0 and Windows and the full
console output is:

log rotation inter-process lock failed. D:\log.txt -> D:\log.txt.0: The process cannot access the file because it is being used by another process.
log writing failed. closed stream
log writing failed. closed stream
...

19fc734638
2022-01-27 12:33:06 +09:00
Jeremy Evans
6f14a30022 [ruby/logger] Consider cygwin a Windows platform
This should fix Ruby Bug 12468.

49de53d1fc
2020-12-04 20:16:00 +09:00
sonots
0aafc32995
[ruby/logger] frozen_string_literal: true
a057eede7b
2019-12-09 19:17:31 +09:00
Rafael Mendonça França
58065b8701
[ruby/logger] Add option to set the binary mode of the log device
Without binmode strings with incompatible encoding can't be written in
the file. This is very common in applications that log user provided
parameters.

We need to allow changing the binnary mode because right now it is impossible to use
the built-in log rotation feature when you provide a File object to the
LogDevice, and if you provide a filename you can't have binmode.

9114b3ac7e
2019-07-15 14:43:08 +09:00
Jeremy Evans
f4064a0a0c
[ruby/logger] Set filename when initializing logger with a File object
This should allow reopen to work.  Requested in ruby issue #14595.

bd367aff12
2019-07-15 14:43:08 +09:00
Samuel Williams
3fdb963827
[ruby/logger] Prefer require_relative, it's a little bit faster.
1e2aab4bea
2019-07-15 14:43:07 +09:00
Colby Swandale
bbe157f340
[ruby/logger] split logger classes/modules into separate files
f10ce9fff2
2019-07-15 14:43:07 +09:00