logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: How to...
Date Thu, 12 Sep 2013 05:04:34 GMT
Since JavaScript is baked in Java 6, that would be the way to go, JS
expressions in attributes or element values.

Right now, I think I'd like to have a Console or more likely a
PatternLayout attribute called "keepAnsiIfNoConsole=true" or
"noConsoleAnsi=true" (can't think of a better name at this hour) if you
REALLY want ANSI if there is no console, which you actually DO want for out
unit tests.

Gary


On Thu, Sep 12, 2013 at 12:44 AM, Ralph Goers <ralph.goers@dslextreme.com>wrote:

> That is one way to do it.  I wouldn't mind adding logic into the
> configuration but I'd hate to do that in XML - then it will look like Maven
> 1 with Jelly.
>
> Ralph
>
>
>
> On Sep 11, 2013, at 9:26 PM, Gary Gregory wrote:
>
> Hi All,
>
> I have a solution implemented locally that does not output ANSI escapes if
> there is no console (it logs a warning to the status logger if it detects
> this condition on start up).
>
> I am wondering if the Console element should have an attribute called
> "autoHideAnsi" or some such to still output ANSI escapes even if there is
> no console.
>
> Gary
>
>
> On Wed, Sep 11, 2013 at 11:12 PM, Gary Gregory <garydgregory@gmail.com>wrote:
>
>> Hi All:
>>
>> Here is my pickle:
>>
>> I have a stock XML config file I package with a standalone app.
>>
>> When I run it on the Windows command line, I want to use a JAnsi logger,
>> it works.
>>
>> When I run the app within Eclipse, the Eclipse console displays junk for
>> the escape codes, not so nice.
>>
>> So I'd like Log4J to use a plain Console appender in this case.
>>
>> The question is:
>>
>> Should Log4J detect that there is no real console? If you call
>> "java.io.Console.console()" from Eclipse, you get null, so that would be
>> one way to gracefully detect that there is no console.
>>
>> Or:
>>
>> Should I be able to have some condition in the config that says if ...
>> enable this appender else enable that one.
>>
>> Or:
>>
>> Should I be able to configure each appender with an "unless" attibute
>> (like in Ant) that tells Log4j to enable the appender unless some condition
>> is not met. It could be "if" instead of "unless" but you get the idea.
>>
>> Thoughts?
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
View raw message