log4perl icon indicating copy to clipboard operation
log4perl copied to clipboard

Unicode file names on Windows?

Open plk opened this issue 4 years ago • 4 comments

Using the file appender and a filename such as "пример.log" on Windows results in:

Can't open ??????.log (Invalid argument) at C:\...lib/Log/Log4perl/Appender/File.pm line 151.

It's fine with common Latin1 things but not Cyrillic etc. Is there a way to do this? In the application that uses this, I had to resort to Win32::Unicode::File in other places as this seems to be the only way to read/write files with such glyphs on Windows?

plk avatar Dec 09 '20 11:12 plk

I can't see an obvious way to log to a filehandle rather than a file? This would make things possible but there is no Appender for file handles? Log::Dispatch::Handle really only works with IO::Handle objects which are too low level.

plk avatar Dec 10 '20 17:12 plk

Have you taken a look at Log::Dispatch::File? That's available as an "appender" in log4perl. If that doesn't support Win32 unicode files, it should probably be made to do so?

mohawk2 avatar Feb 10 '21 20:02 mohawk2

I tried that too but no luck - I think whatever the package, it has to use the lower-level "wide" windows APIs or it just wont' work in general.

plk avatar Feb 11 '21 11:02 plk

Yes, it will have to use the right API. If it doesn't do so now, then it can be made to do so via a pull request?

mohawk2 avatar Feb 11 '21 12:02 mohawk2