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 <garydgreg...@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: garydgreg...@gmail.com | ggreg...@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
> 
> 
> 
> -- 
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Reply via email to