cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

Do we have anything for Loggers so that will get input and output information directly in Windchill

Pushpak_Old
9-Granite

Do we have anything for Loggers so that will get input and output information directly in Windchill

Hi All,
I want to enable debug loggers in our code,  But when we started updating whole package we end up, having huge amount of class files , Is there any way to implement the logger so that it automatically prints the input and outputs automatically. Like 

@Loggable  

from spring-aop

@HelesicPetr  @manoj_dokku2 

4 REPLIES 4
avillanueva
22-Sapphire II
(To:Pushpak_Old)

Had to google this. I am not too familiar with this annotation. I would think this requires some configuration to be useful right? Is this six of one, half a dozen of the other? Typically I copy this standard block in any class of significance:

import org.apache.log4j.Logger;    
import wt.log4j.LogR;
    private static Logger log = null;
    static {
        try {
            log = LogR.getLogger(<CLASSNAME>.class.getName());
        } catch (Exception e) {
        }
    }
...
log.debug(children.getLength() + " child nodes");

Then I sprinkle logging where needed either debug or other types. Messages appear in MethodServer logs and are easy to filter on using System Monitor. This will require editing your class files to implement but logging should be a core practice when starting a new file. Does this help or were you really looking to use annotations?

Hi @avillanueva ,

Thanks for quick response!!!!

We have this Logger.isDebugEnabled(0 method but what if I have Multiple parameter as input so every time I have to log each and every input manually so Do we have any automation here?

avillanueva
22-Sapphire II
(To:Pushpak_Old)

But don't you have to seed the Annotation "@Loggable" preceding all the methods? I can't see why this would not work except needed to include the right JAR file to Windchill.

https://www.yegor256.com/2014/06/01/aop-aspectj-java-method-logging.html

Perhaps we are attacking this same problem from two different avenues.  I find it might easier to log as I described and how PTC does things. And its flexible enough to turn on and off as needed via Monitoring tools.

avillanueva_0-1657035172440.png

 

Hi @Pushpak_Old 

You have to log what you want to see in your code. There is no debug logger if you don't write it.

Each service has own logger and all outputs are written in the code. 

PetrH

Top Tags