Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
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
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?
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.
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