Hey Romain,
I didn't have a chance to go through the tomcat handler, but I found a
solution...

@javax.ejb.Singleton
@Startup
class LogListenerImpl extends Handler {
    def messages = [] // TODO: handle this

    @PostConstruct
    public void start() {
        LogManager.logManager.loggerNames.each { name ->
            def logger = Logger.getLogger(name)
            logger.addHandler(this)
        }
    }

    @PreDestroy
    public void shutdown() {
        LogManager.logManager.loggerNames.each { name ->
            def logger = Logger.getLogger(name)
            logger.removeHandler(this)
        }
    }

    @Override
    void publish(LogRecord record) {
        if (record.level == Level.SEVERE || record.level == Level.WARNING) {
            messages << new LogMessageDto(
                    level: record.level,
                    timestamp: record.millis,
                    message: record.message
            )
        }
    }

    @Override
    void flush() {
        // no-op
    }

    @Override
    void close() throws SecurityException {
        // no-op
    }
}

It works, but not sure it's cool. Do you think that's ok?

[]s,
Thiago.




On Sat, Sep 21, 2013 at 9:44 AM, Romain Manni-Bucau
<[email protected]>wrote:

> Hi
>
> Have a look to
>
> http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/juli/ClassLoaderLogManager.htmland
> catalina.sh which set it
> Le 21 sept. 2013 15:02, "Thiago Veronezi" <[email protected]> a écrit :
>
> > and...
> >
> >
> http://docs.oracle.com/javase/6/docs/api/java/util/logging/MemoryHandler.html
> >  with
> > http://docs.oracle.com/javase/6/docs/api/java/util/logging/Filter.html
> >
> >
> > On Sat, Sep 21, 2013 at 8:51 AM, Thiago Veronezi <[email protected]
> > >wrote:
> >
> > > Cool! Can you give me more tips on how to hijack the LogManager?
> > > I will try to use
> > >
> http://docs.oracle.com/javase/6/docs/api/java/util/logging/Handler.html
> > > Please let me know if I am in a completely wrong direction. :)
> > >
> > > >>how do you store it?
> > > It would be in-memory but ephemeral and limited to a X number of logs.
> > > The flags would be cleaned out after Y minutes.
> > >
> > > []s,
> > > Thiago
> > >
> > >
> > >
> > > On Sat, Sep 21, 2013 at 8:24 AM, Romain Manni-Bucau <
> > [email protected]
> > > > wrote:
> > >
> > >> We can replace default logmanger by our own and wrap all handlers but
> > then
> > >> how do you store it?
> > >> Le 21 sept. 2013 14:19, "Thiago Veronezi" <[email protected]> a
> > écrit :
> > >>
> > >> > Hi Daniel,
> > >> > Possibly. :) Thanks!
> > >> >
> > >> > https://dl.dropboxusercontent.com/u/1459144/tomee-list/errors.png
> > >> > https://dl.dropboxusercontent.com/u/1459144/tomee-list/warnings.png
> > >> >
> > >> > []s,
> > >> > Thiago.
> > >> >
> > >> >
> > >> >
> > >> > On Sat, Sep 21, 2013 at 8:13 AM, dsh <[email protected]>
> > wrote:
> > >> >
> > >> > > Hi,
> > >> > >
> > >> > > Could it be that images have been stripped from your original
> mail?
> > >> > >
> > >> > > Cheers
> > >> > > Daniel
> > >> > >
> > >> > >
> > >> > > On Sat, Sep 21, 2013 at 2:08 PM, Thiago Veronezi <
> > [email protected]
> > >> > > >wrote:
> > >> > >
> > >> > > > Do you know an elegant way to listen all the loggers?
> > >> > > > I would like to add a flag into the gui like...
> > >> > > >
> > >> > > > [image: Inline image 1]
> > >> > > >
> > >> > > > [image: Inline image 2]
> > >> > > >
> > >> > > > Clicking on the error or warning signs would open the "Log
> Files",
> > >> and
> > >> > it
> > >> > > > would try to show the file that contains the log message at the
> > >> right
> > >> > > > position.
> > >> > > >
> > >> > > > Do you think that's possible to catch all the "LOG.error()" and
> > >> > > > "LOG.warning()" calls?
> > >> > > >
> > >> > > > Btw Romain,
> > >> > > > I like your idea about the loggers. I will try that out.
> > >> > > >
> > >> > > > []s,
> > >> > > > Thiago.
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > On Fri, Sep 20, 2013 at 8:03 AM, Romain Manni-Bucau <
> > >> > > [email protected]
> > >> > > > > wrote:
> > >> > > >
> > >> > > >> About the log i think we'd need something like
> > >> > > >> https://gist.github.com/rmannibucau/116e61ed495537cf0d41
> > >> > > >>
> > >> > > >> *Romain Manni-Bucau*
> > >> > > >> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > >> > > >> *Blog: **http://rmannibucau.wordpress.com/*<
> > >> > > >> http://rmannibucau.wordpress.com/>
> > >> > > >> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > >> > > >> *Github: https://github.com/rmannibucau*
> > >> > > >>
> > >> > > >>
> > >> > > >>
> > >> > > >> 2013/9/20 Thiago Veronezi <[email protected]>
> > >> > > >>
> > >> > > >> > Hi Romain,
> > >> > > >> > Thanks for sorting that all up!
> > >> > > >> >
> > >> > > >> > >>4) i added tomee maven plugin in webaccess-gui and now you
> > can
> > >> do
> > >> > > from
> > >> > > >> > this
> > >> > > >> > >>module: mvn tomee:run and access the gui from
> > >> > > http://localhost:8080/
> > >> > > >> > I like it. Thanks.
> > >> > > >> >
> > >> > > >> > >>we need jaxrs cause of rest front, that's ok for me but it
> > >> should
> > >> > be
> > >> > > >> > mentiionned
> > >> > > >> > if running on a webprofile IMO, wdyt?
> > >> > > >> > Agree, it would need a side note. This application wouldn't
> be
> > >> part
> > >> > of
> > >> > > >> the
> > >> > > >> > distribution. It would be an extra downloadable war.  We
> could
> > >> add
> > >> > the
> > >> > > >> not
> > >> > > >> > close to where the users would download it.
> > >> > > >> >
> > >> > > >> > >>I see you use some EJBs but is it relevant since they don't
> > >> have
> > >> > any
> > >> > > >> > >>business method (on static utilities)?
> > >> > > >> > I guess I can use static utilities instead.
> > >> > > >> >
> > >> > > >> > >>In SessionListener isn't photoDB a copy/paste (in the log)
> > ;)?
> > >> > > >> > Yep. :)
> > >> > > >> >
> > >> > > >> > >>Do we need these logs in info?
> > >> > > >> > Probably not.
> > >> > > >> >
> > >> > > >> > >>Finally about logs: isn't it more relevant to get the
> > >> LogManager
> > >> > and
> > >> > > >> get
> > >> > > >> > >>handlers from it to extract directories to list? ATM if we
> > >> > configure
> > >> > > >> logs
> > >> > > >> > >>to be in let say /opt/logs we'll miss it.
> > >> > > >> > How does this work?
> > >> > > >> >
> > >> > > >> >
> > >> > > >> >
> > >> > > >> > []s,
> > >> > > >> > Thiago.
> > >> > > >> >
> > >> > > >> >
> > >> > > >> > On Fri, Sep 20, 2013 at 2:42 AM, Romain Manni-Bucau
> > >> > > >> > <[email protected]>wrote:
> > >> > > >> >
> > >> > > >> > > Hi Thiago,
> > >> > > >> > >
> > >> > > >> > > i updated quickly what you commited.
> > >> > > >> > >
> > >> > > >> > > basically:
> > >> > > >> > > 1) using org.apache.tomee as base package
> > >> > > >> > > 2) using tomee-admin role (we add it by default so if we
> > prefer
> > >> > > >> 'tomee'
> > >> > > >> > we
> > >> > > >> > > need to change it everywhere we can use it)
> > >> > > >> > > 3) removing beans.xml/ejb-jar.xml/persistence.xml: the last
> > was
> > >> > > >> creating
> > >> > > >> > > datasources for nothing, the 2 others looked useless
> > >> > > >> > > 4) i added tomee maven plugin in webaccess-gui and now you
> > can
> > >> do
> > >> > > from
> > >> > > >> > this
> > >> > > >> > > module: mvn tomee:run and access the gui from
> > >> > > http://localhost:8080/-
> > >> > > >> > we
> > >> > > >> > > need jaxrs cause of rest front, that's ok for me but it
> > should
> > >> be
> > >> > > >> > > mentiionned if running on a webprofile IMO, wdyt?
> > >> > > >> > >
> > >> > > >> > > I see you use some EJBs but is it relevant since they don't
> > >> have
> > >> > any
> > >> > > >> > > business method (on static utilities)?
> > >> > > >> > >
> > >> > > >> > > In SessionListener isn't photoDB a copy/paste (in the log)
> > ;)?
> > >>  Do
> > >> > > we
> > >> > > >> > need
> > >> > > >> > > these logs in info?
> > >> > > >> > >
> > >> > > >> > > Finally about logs: isn't it more relevant to get the
> > >> LogManager
> > >> > and
> > >> > > >> get
> > >> > > >> > > handlers from it to extract directories to list? ATM if we
> > >> > configure
> > >> > > >> logs
> > >> > > >> > > to be in let say /opt/logs we'll miss it.
> > >> > > >> > >
> > >> > > >> > >
> > >> > > >> > > *Romain Manni-Bucau*
> > >> > > >> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > >> > > >> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > >> > > >> > > http://rmannibucau.wordpress.com/>
> > >> > > >> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > >> > > >> > > *Github: https://github.com/rmannibucau*
> > >> > > >> > >
> > >> > > >> > >
> > >> > > >> > >
> > >> > > >> > > 2013/9/19 Thiago Veronezi <[email protected]>
> > >> > > >> > >
> > >> > > >> > > > Looks good. Will do.
> > >> > > >> > > > Anyway, it wont affect the core TomEE and the real job it
> > >> does.
> > >> > > >> > > > []s,
> > >> > > >> > > > Thiago.
> > >> > > >> > > >
> > >> > > >> > > >
> > >> > > >> > > >
> > >> > > >> > > >
> > >> > > >> > > > On Thu, Sep 19, 2013 at 3:13 PM, Romain Manni-Bucau
> > >> > > >> > > > <[email protected]>wrote:
> > >> > > >> > > >
> > >> > > >> > > > > ...or push what you have in mind. ATM nobody uses the
> gui
> > >> so
> > >> > > make
> > >> > > >> > your
> > >> > > >> > > > > ideas real, it can't hurt anybody while you don't brind
> > >> > > >> dependencies
> > >> > > >> > > ;),
> > >> > > >> > > > > we'll discuss if any issue pops up.
> > >> > > >> > > > >
> > >> > > >> > > > > *Romain Manni-Bucau*
> > >> > > >> > > > > *Twitter: @rmannibucau <
> https://twitter.com/rmannibucau
> > >*
> > >> > > >> > > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > >> > > >> > > > > http://rmannibucau.wordpress.com/>
> > >> > > >> > > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > >> > > >> > > > > *Github: https://github.com/rmannibucau*
> > >> > > >> > > > >
> > >> > > >> > > > >
> > >> > > >> > > > >
> > >> > > >> > > > > 2013/9/19 Thiago Veronezi <[email protected]>
> > >> > > >> > > > >
> > >> > > >> > > > > > Ok,
> > >> > > >> > > > > >
> > >> > > >> > > > > > I will let it out of the application at the moment,
> so
> > I
> > >> can
> > >> > > >> commit
> > >> > > >> > > > what
> > >> > > >> > > > > I
> > >> > > >> > > > > > have.
> > >> > > >> > > > > > I think the web app is much better now, but I will
> > need a
> > >> > > quick
> > >> > > >> > vote
> > >> > > >> > > > for
> > >> > > >> > > > > > what I have in mind.
> > >> > > >> > > > > >
> > >> > > >> > > > > > New email shortly... as soon as I get back home. :)
> > >> > > >> > > > > >
> > >> > > >> > > > > > []s,
> > >> > > >> > > > > > Thiago.
> > >> > > >> > > > > >
> > >> > > >> > > > > >
> > >> > > >> > > > > >
> > >> > > >> > > > > > On Thu, Sep 19, 2013 at 3:02 PM, Romain Manni-Bucau
> > >> > > >> > > > > > <[email protected]>wrote:
> > >> > > >> > > > > >
> > >> > > >> > > > > > > It is doable integrating a bit more with CXF (to be
> > >> > > consistent
> > >> > > >> > > > between
> > >> > > >> > > > > > EJB
> > >> > > >> > > > > > > and Pojo) to get ClassResourceInfos. Did you look
> > >> through
> > >> > > the
> > >> > > >> > > > > destination
> > >> > > >> > > > > > > and our cxf bus? isn't it possible?
> > >> > > >> > > > > > >
> > >> > > >> > > > > > > Otherwise we could save getClassResourceInfos
> during
> > >> > > >> deployment
> > >> > > >> > (we
> > >> > > >> > > > > need
> > >> > > >> > > > > > to
> > >> > > >> > > > > > > take caer cleaning it up then).
> > >> > > >> > > > > > >
> > >> > > >> > > > > > > Honestly I think that's not the biggest issue of
> our
> > >> GUI
> > >> > > ATM.
> > >> > > >> > JAXRS
> > >> > > >> > > > is
> > >> > > >> > > > > > not
> > >> > > >> > > > > > > the base feature of TomEE (even if useful). We
> don't
> > >> have
> > >> > a
> > >> > > >> way
> > >> > > >> > to
> > >> > > >> > > > > create
> > >> > > >> > > > > > > graphically resources, manage containers etc....
> ATM
> > >> I'm
> > >> > not
> > >> > > >> sure
> > >> > > >> > > > TomEE
> > >> > > >> > > > > > is
> > >> > > >> > > > > > > GUI compatible (sadly), I even wondered if we
> should
> > >> ship
> > >> > > one
> > >> > > >> (we
> > >> > > >> > > > don't
> > >> > > >> > > > > > > need anymore for EJBd).
> > >> > > >> > > > > > >
> > >> > > >> > > > > > > Using JMX as base can help since a lot is exported.
> > >> > > >> > > > > > >
> > >> > > >> > > > > > > Wdyt Thiago?
> > >> > > >> > > > > > >
> > >> > > >> > > > > > > *Romain Manni-Bucau*
> > >> > > >> > > > > > > *Twitter: @rmannibucau <
> > >> https://twitter.com/rmannibucau>*
> > >> > > >> > > > > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > >> > > >> > > > > > > http://rmannibucau.wordpress.com/>
> > >> > > >> > > > > > > *LinkedIn: **
> http://fr.linkedin.com/in/rmannibucau*
> > >> > > >> > > > > > > *Github: https://github.com/rmannibucau*
> > >> > > >> > > > > > >
> > >> > > >> > > > > > >
> > >> > > >> > > > > > >
> > >> > > >> > > > > > > 2013/9/19 Thiago Veronezi <[email protected]>
> > >> > > >> > > > > > >
> > >> > > >> > > > > > > > Guys,
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > Is there a way to list all the endpoints of a
> rest
> > >> > > >> application?
> > >> > > >> > > > > > Something
> > >> > > >> > > > > > > > like what we have in the log files?
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > DELETE
> > >> http://localhost:8080/photodb/rest/photos/{id}->
> > >> > > >> > > > >  Boolean
> > >> > > >> > > > > > > > delete(Long)
> > >> > > >> > > > > > > > GET http://localhost:8080/photodb/rest/photos/->
> > >> > >  List
> > >> > > >> > > list()
> > >> > > >> > > > > > > throws
> > >> > > >> > > > > > > > IOException
> > >> > > >> > > > > > > > GET
> > http://localhost:8080/photodb/rest/photos/{id}->
> > >> > > >> > > >  PhotoDto
> > >> > > >> > > > > > > > get(Long)
> > >> > > >> > > > > > > > POST http://localhost:8080/photodb/rest/photos/->
> > >> > > >> >  PhotoDto
> > >> > > >> > > > > > > > post(PhotoDto)
> > >> > > >> > > > > > > > PUT http://localhost:8080/photodb/rest/photos/->
> > >> > > >> >  PhotoDto
> > >> > > >> > > > > > > > put(PhotoDto)
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > I would like to create a REST client in the TomEE
> > GUI
> > >> > > which
> > >> > > >> > lists
> > >> > > >> > > > all
> > >> > > >> > > > > > the
> > >> > > >> > > > > > > > available services.
> > >> > > >> > > > > > > > It would have a dropdown list with the paths of
> the
> > >> > > >> endpoints
> > >> > > >> > and
> > >> > > >> > > > the
> > >> > > >> > > > > > > > available HTTP methods for those; and a grid
> where
> > >> the
> > >> > > user
> > >> > > >> > would
> > >> > > >> > > > > pass
> > >> > > >> > > > > > > the
> > >> > > >> > > > > > > > "form" parameters. I guess this would be very
> > useful
> > >> for
> > >> > > >> devs.
> > >> > > >> > > > Maybe
> > >> > > >> > > > > > even
> > >> > > >> > > > > > > > for ops.
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > For now, the only thing I'm able to list is "
> > >> > > >> > > > > > > > http://localhost:8080/photodb/rest ->
> > >> > > >> > > > > > photodb.service.ApplicationConfig"
> > >> > > >> > > > > > > > (via "WebServiceHelperImpl"). I know where the
> > system
> > >> > logs
> > >> > > >> the
> > >> > > >> > > > > > > information
> > >> > > >> > > > > > > > above, but I can't manage to see where it is
> saved
> > >> and
> > >> > how
> > >> > > >> to
> > >> > > >> > > > > retrieve
> > >> > > >> > > > > > > it.
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > Any hint?
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > []s,
> > >> > > >> > > > > > > > Thiago.
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > On Thu, Sep 19, 2013 at 10:15 AM, Thiago
> Veronezi <
> > >> > > >> > > > > [email protected]
> > >> > > >> > > > > > > > >wrote:
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > > > > Hi devs,
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > > > I just would like to let you know that I didn't
> > >> forget
> > >> > > >> about
> > >> > > >> > > the
> > >> > > >> > > > > gui.
> > >> > > >> > > > > > > :O)
> > >> > > >> > > > > > > > > I'm working on a new polished version of the
> > TomEE
> > >> > GUI.
> > >> > > >> > > > > > > > > It should be committed this evening.
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > >
> > >> > > >> > > > > >
> > >> > > >> > > > >
> > >> > > >> > > >
> > >> > > >> > >
> > >> > > >> >
> > >> > > >>
> > >> > >
> > >> >
> > >>
> >
> https://dl.dropboxusercontent.com/u/1459144/tomee-list/new_polished_ui_01.png
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > >
> > >> > > >> > > > > >
> > >> > > >> > > > >
> > >> > > >> > > >
> > >> > > >> > >
> > >> > > >> >
> > >> > > >>
> > >> > >
> > >> >
> > >>
> >
> https://dl.dropboxusercontent.com/u/1459144/tomee-list/new_polished_ui_02.png
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > > > I still need to but back the list of
> webservices
> > >> and
> > >> > > >> jndi. I
> > >> > > >> > > will
> > >> > > >> > > > > > > > probably
> > >> > > >> > > > > > > > > ping you guys later for some help/advice.
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > > > []s,
> > >> > > >> > > > > > > > > Thiago.
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > > >
> > >> > > >> > > > > > > >
> > >> > > >> > > > > > >
> > >> > > >> > > > > >
> > >> > > >> > > > >
> > >> > > >> > > >
> > >> > > >> > >
> > >> > > >> >
> > >> > > >>
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Reply via email to