App A uses log4j2 logs to files. It's not too much data. I want to do what
chain saw does but without the UI. I want to read the log file. Get the
info back as a java objects. Then process them. Many lines are multiline.
So don't want to write this code my self. Yes I want the object back I'm on
my App B for further processing. APP A has many flavours with different
log4j2 config files with different patterns. But all writing to file system.
Just not sure what code parses lines from a log to create a log event in
Java?

Thank you for your time.

On 3 Feb 2018 03:30, "Ralph Goers" <ralph.go...@dslextreme.com> wrote:

> Actually I should clarify this a bit.  Log4j does have Appenders that will
> write to Kafka or similar frameworks, but I am gathering from what you
> asked for that you want something that is entirely in the application.
>
> Ralph
>
> > On Feb 2, 2018, at 2:58 PM, Ralph Goers <ralph.go...@dslextreme.com>
> wrote:
> >
> > You would want to create an Appender that publishes to registered
> listeners. Log4j currently doesn’t have one but it would be pretty simple
> to create one.
> >
> > Ralph
> >
> >> On Feb 2, 2018, at 6:09 AM, Tushar Kapila <tgkp...@gmail.com> wrote:
> >>
> >> Am sure this has been asked before but i could not find code that works
> >>
> >> Looking for an example of code where there is no UI. Batch mode, give a
> >> file path, a config file (log4j2),
> >> get call backs of log events read to a listener method. Possible in
> >> chainsaw or other FOSS?
> >>
> >> Psudedo code:
> >>
> >> Set it up:
> >> File myLogFile = new File("path/a.log")
> >> File myConfigFile = new File("path/log4j.xml")
> >> myListener listr = new MyLsitenter();
> >>
> >> theLibrary.process(listr, myConfigFile, myLogFile);
> >>
> >> In the listener
> >>
> >> public void onEvnt(LogRecord logRecord){
> >>   logRecord.getDate();
> >>   logRecord.getThread()
> >>   logRecord.getLevel();
> >>   logRecord.getMessage() ; //could be multiline too,etc
> >>
> >> --
> >> Regards
> >> Tushar Kapila
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>

Reply via email to