Skip to main content
10-Marble
July 5, 2022
Question

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

  • July 5, 2022
  • 1 reply
  • 1369 views

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 

1 reply

avillanueva
23-Emerald I
23-Emerald I
July 5, 2022

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?

10-Marble
July 5, 2022

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
23-Emerald I
23-Emerald I
July 5, 2022

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