Re: TimeFilterTest

2020-03-10 Thread Matt Sicker
Garbage free use cases typically have daily downtime (after trading closes for the day for example), though admittedly I don’t know everyone’s use cases. On Tue, Mar 10, 2020 at 23:55 Ralph Goers wrote: > I have modified TimeFilter to properly account for the change from > daylight saving time t

Re: TimeFilterTest

2020-03-10 Thread Ralph Goers
I have modified TimeFilter to properly account for the change from daylight saving time to standard time and vice-versa. I also modified it to handle a start time on the day before the end time. I have a suspicion that this filter is being lightly used because there are a whole lot of use cases

Re: Emoji in PatternLayout?

2020-03-10 Thread Matt Sicker
You can encode it with \u codes. Emoji require multiple code points anyways, so file formats can get weird whenever they're not using UTF-8. On Tue, 10 Mar 2020 at 19:33, Gary Gregory wrote: > I do not think your file.encoding sys prop matters, see the Javadoc for the > Properties class. > > Gar

Re: Emoji in PatternLayout?

2020-03-10 Thread Gary Gregory
I do not think your file.encoding sys prop matters, see the Javadoc for the Properties class. Gary On Tue, Mar 10, 2020, 20:22 Christopher wrote: > That was my guess, but I don't see how this could happen since my JVM > default encoding, my terminal, System.getProperty("file.encoding"), > Syste

Re: Emoji in PatternLayout?

2020-03-10 Thread Christopher
According to https://en.wikipedia.org/wiki/.properties , .properties files are ISO-8859-1, except Java reads them as UTF-8 since Java 9, and falls back to ISO-8859-1. I'd have to dig further to see how log4j is reading the config files. It might be a library or custom code that assumes ISO-8859-1,

Re: Emoji in PatternLayout?

2020-03-10 Thread Christopher
That was my guess, but I don't see how this could happen since my JVM default encoding, my terminal, System.getProperty("file.encoding"), System.getProperty("input.encoding") and the BOM in the config file are all UTF-8. I'm using Java 11. On Tue, Mar 10, 2020 at 8:17 PM Carter Kozak wrote: > I

Re: Emoji in PatternLayout?

2020-03-10 Thread Gary Gregory
I think only new Java versions parse prop files as utf8 Gary On Tue, Mar 10, 2020, 20:17 Carter Kozak wrote: > I wonder if the log4j2.properties file is being parsed as ISO-8859-1 > rather than UTF-8, so we're not reading the cat properly? > > On Tue, Mar 10, 2020, at 20:04, Christopher wrote:

Re: Emoji in PatternLayout?

2020-03-10 Thread Carter Kozak
I wonder if the log4j2.properties file is being parsed as ISO-8859-1 rather than UTF-8, so we're not reading the cat properly? On Tue, Mar 10, 2020, at 20:04, Christopher wrote: > In my log4j2.properties file, I used: > > appender.console.type = Console > appender.console.name = STDERR > appende

Re: Emoji in PatternLayout?

2020-03-10 Thread Christopher
In my log4j2.properties file, I used: appender.console.type = Console appender.console.name = STDERR appender.console.target = SYSTEM_ERR appender.console.layout.type = PatternLayout appender.console.layout.pattern = 🐈%style{%d{ISO8601}}{dim,cyan} %style{[}{red}%style{%-8c{2}}{dim,blue}%style{]}{r

Re: Emoji in PatternLayout?

2020-03-10 Thread Ralph Goers
Did you specify a charset on the layout that supports that character? Ralph > On Mar 10, 2020, at 1:57 PM, Christopher wrote: > > I tried to put in a kitty (🐈) in my LayoutPattern, but it didn't > work. It replaced it with some weird character. Is this is a known > bug? > Does PatternLayout not

Emoji in PatternLayout?

2020-03-10 Thread Christopher
I tried to put in a kitty (🐈) in my LayoutPattern, but it didn't work. It replaced it with some weird character. Is this is a known bug? Does PatternLayout not support wide characters?

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Gary Gregory
On Tue, Mar 10, 2020 at 12:06 PM Ralph Goers wrote: > > > > On Mar 10, 2020, at 8:40 AM, Gary Gregory > wrote: > > > > My POV has nothing to do with performance, more about code clarity. > > Building strings 'manually' can be error/typo prone, you can type a ',' > > instead of a '.' for example.

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Ralph Goers
> On Mar 10, 2020, at 8:40 AM, Gary Gregory wrote: > > My POV has nothing to do with performance, more about code clarity. > Building strings 'manually' can be error/typo prone, you can type a ',' > instead of a '.' for example. The idea being using String... was to > formalize the split of hi

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Gary Gregory
My POV has nothing to do with performance, more about code clarity. Building strings 'manually' can be error/typo prone, you can type a ',' instead of a '.' for example. The idea being using String... was to formalize the split of hierarchical elements just like you see in APIs like java.nio.file.P

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Carter Kozak
Yes, I was agreeing with you, Ralph. My (poorly articulated) point was that concatenation can be optimized by the compiler as you mentioned, in addition to cases where not all of the values are known at compile time. Sorry for the confusion! -ck On Tue, Mar 10, 2020, at 11:13, Ralph Goers wro

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Ralph Goers
Even with that, it is still no match for string concatenation performed by the compiler. Notice that Gary’s example is concatenating two constants. The compiler can detect that and concatenate them into a single string during compilation. In any case, using the comma operator means we would h

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Carter Kozak
Jdk9+ provides https://openjdk.java.net/jeps/280 which makes string concatenation with dynamic values more performant than string builders. That said, requesting loggers from the context is already relatively expensive and isn't expected to be on hot paths. -ck On Tue, Mar 10, 2020, at 10:32,

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Ralph Goers
Cleaner? You changed a plus sign to a comma and turned the concatenation from happening at compile time to runtime. Even if you could I would argue you shouldn’t. Ralph > On Mar 10, 2020, at 7:10 AM, Gary Gregory wrote: > > On Mon, Mar 9, 2020 at 11:10 AM Ralph Goers > wrote: > >> Why would

Re: [log4j] getLogger(String... name)?

2020-03-10 Thread Gary Gregory
On Mon, Mar 9, 2020 at 11:10 AM Ralph Goers wrote: > Why would you want to do that? Most people seem to prefer getLogger() > while I prefer getLogger(MyClass.class). I can’t imagine why anyone would > want to dynamically construct a name like that and if they did, why > wouldn’t they just using