Cant see javasimon logs using Spring application

309 views
Skip to first unread message

Idan Fridman

unread,
Aug 7, 2013, 8:44:33 AM8/7/13
to java...@googlegroups.com
Hi,
I have installed JavaSimon in my Spring container. 
I am using Junit to test this monitoring tool.

I have added to my conext xml the beans as instructed in Wiki.
I add @Monitored to the class I want to monitor.

Now what is the next step? let's say I want to monitor a method invocation (how long it took for it to be invoked):

@Named
@Monitored
public class Myclass{
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Myclass.class);

public void execute(..) {
           //doSomething
          }
}

Now how I see the monitoring results? what am I missing?
thanks,
Idan.

Richard Richter

unread,
Aug 7, 2013, 8:51:11 AM8/7/13
to java...@googlegroups.com
Hi

Check the section Monitoring the business layer on this page:
http://code.google.com/p/javasimon/wiki/JavaEE

Something needs to pick the annotation, the configuration is described there.

Cheers

Virgo
> --
> You received this message because you are subscribed to the Google Groups
> "javasimon" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to javasimon+...@googlegroups.com.
> To post to this group, send email to java...@googlegroups.com.
> Visit this group at http://groups.google.com/group/javasimon.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Idan Fridman

unread,
Aug 7, 2013, 9:16:33 AM8/7/13
to java...@googlegroups.com
Hi,
It would be great if I could have some Spring example with Java Simon. Do you have such an example?

Thanks,
Idan.

Richard Richter

unread,
Aug 7, 2013, 10:17:08 AM8/7/13
to java...@googlegroups.com
No we don't have anything more than on the page and in the sources. I
know it works, we use it on project. But there is no logging out of
the box - Simons collect data, logging is additional feature and you
need to add a Callback for that. More about callbacks here:
http://code.google.com/p/javasimon/wiki/Callbacks

You may need to actually code something in order to do that. Try to
find out if there are some simons in your application after a few
requests. SimonManager class should help you with this - and again,
you may need to code something.

If you want something working out of the box and avoid coding
altogether, Simon may not be the best solution for you.

Cheers

Idan Fridman

unread,
Aug 13, 2013, 3:47:03 AM8/13/13
to java...@googlegroups.com
Hi,
I tried to watch the statistics in the GUI console. But everything is empty.  I have @Monitored some classes just to have some examples.

Any idea what could be the reason for having blank rows in the console?

thanks,
ray.

Richard Richter

unread,
Aug 13, 2013, 4:00:20 AM8/13/13
to java...@googlegroups.com
@Monitored doesn't work just so. First you have to setup AOP properly.

Also - "everything is empty" means what exactly? Do you see the Simon
Console page, everything seems OK, just the list is empty? If so, try
anywhere in your active code
SimonManager.getStopwatch("bubu").start().stop() and see if it shows
there. Take one step at a time, otherwise it's very hard to say what
(all) doesn't work.

Have you made sure that some Simon actually measures something
(without @Monitored or any other magic)? Have you tried
SimonServletFilter as well? That one is much easier to setup and get
some results fast.

Virgo

Idan Fridman

unread,
Aug 13, 2013, 7:52:39 AM8/13/13
to java...@googlegroups.com
Hi Virgo,
I added that line.
I created the aop point cut:

 <bean id="monitoringInterceptor" class="org.javasimon.spring.MonitoringInterceptor"/>

        <aop:config proxy-target-class="true">
       
                <!-- name of the class or interface -->
                <aop:pointcut id="monitoringPointcut" expression="execution(* com.myexample..*(..))"/>
                <aop:advisor advice-ref="monitoringInterceptor" pointcut-ref="monitoringPointcut"/>
        </aop:config>


I ran the app and invoked the method which contains SimonManager.getStopwatch("bubu").start().stop()

After that checked the Console - still empty list.

Sandy Shinn

unread,
Aug 14, 2014, 10:17:06 AM8/14/14
to java...@googlegroups.com, idan.f...@tikalk.com
Ian,

I'm not sure if this is the problem, but IF you are doing the shared installation, you can only have one copy of javasimon-core-*.jar in your web server's directory.  I created a common/lib for that and I remove it from my <webapp>/WEB-INF/lib directory prior to starting the web server.

Sandy

Richard Richter

unread,
Aug 14, 2014, 4:11:03 PM8/14/14
to java...@googlegroups.com
Hi Idan

If you ran start/stop programatically and it does not appear in the
console, then it will not be problem of AOP setup (or at least not
necessary), but that of console. If you're using also Simon's servlet
filter, you can access its simplified text base console which goes the
most direct way to the SimonManager. For instance in Java Simon
sources there is demoapp module, that can be run and tested on
http://localhost:8080 and this one has the following config in its
web.xml:
<filter>
<filter-name>simon-filter</filter-name>
<filter-class>org.javasimon.javaee.SimonServletFilter</filter-class>
...
<init-param>
<param-name>console-path</param-name>
<param-value>/simon</param-value>
</init-param>
...

With this you can see current Simons when you access:
http://localhost:8080/simon

Working console is here:
http://localhost:8080/console-servlet/index.html

Java Simon allows you to use other Simon manager, which is not
currently supported by the web console, I think. I believe it goes
only to SimonManager.

The rest is up to your debugging skills really. :-)

Virgo
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages