Hi,
I plan to write a LogMX "AutoConfigParser" that uses a LogMX/config property to get the location (path) of a log4J.xml config file containing a pattern layout. Then, I will parse this layout, e.g., using Jakarta commons Digester, extract the layout pattern AND DELIVER THIS LAYOUT PATTERN STRING to your Log4JPatternParser. Unfortenately this nice approach to have log4J.xml config and the parser always in sync is not realizable with the current version of LogMX "1.2.6". The Log4JPatternParser has no public available API with a constructor that takes over a log4J layout pattern.
However, does anybody know a way to realize my idea?
--Klaus
How to access your Log4JPatternParser programatically?
Moderator: admin
Hello,
You're right, it would be a good idea and very useful in your case. But we don't provide such API to avoid other developpers using it to write his/her own log viewer...
Using LogMX v1.2.6 free evaluation version (and only this version due to JAR obfuscation), you can still create a Java Class Parser that only uses a Log4j pattern like you described:
(you must not create this class in a package, but use the Java "default package" to access obfuscated LogMX Jar classes....)
Then simply add this Java Class Parser to test it (Tools > Options > Parsers > "Add" button > Java Class Parser).
Hope this helps.
Xavier.
You're right, it would be a good idea and very useful in your case. But we don't provide such API to avoid other developpers using it to write his/her own log viewer...
Using LogMX v1.2.6 free evaluation version (and only this version due to JAR obfuscation), you can still create a Java Class Parser that only uses a Log4j pattern like you described:
(you must not create this class in a package, but use the Java "default package" to access obfuscated LogMX Jar classes....)
Code: Select all
import java.util.ArrayList;
import java.util.List;
import com.lightysoft.logmx.mgr.parsers.Log4jPatternLogFileParser;
public class TestParser extends Log4jPatternLogFileParser {
public TestParser() {
super(getL4jPatternToUse());
}
// The obfuscated class "fS" is in fact a "Log4jPatternParser"....
private static fS getL4jPatternToUse() {
String pattern = "%d{HH:mm:ss,SSS} | %-5p | %c | %m";
// If you use 'System.getProperty("my.pattern.file")', you will get the value of
// line "my.pattern.file=..." in file "config/parsers.properties" of your LogMX directory
// String pattern = System.getProperty("my.pattern.file");
// This List actually configures log4j tags like you can see in the L4j Parser
// creation dialog (options like "may contain spaces", "include in message")
// but its type is hidden here
List log4jTagsSettings = new ArrayList();
// Return the Log4jPattern
return new fS(pattern, log4jTagsSettings, true);
}
public String getParserName() {
return "Test parser";
}
public String getSupportedFileType() {
return "test";
}
}
Hope this helps.
Xavier.
Hi Xavier,
I can fully understand that you protect your investment by obfuscation .
Anyhow, thanks a lot for this great and quick help! No I can start to write my LogMX "AutoConfigParser" using version 1.2.6...
LogMX is a cool tool, even better than Chainsaw; at least in my opinion.
Even the eval version gives a good overview about what is possible and buying the professional version the user has really a great tool!
Thanks.
--Klaus
I can fully understand that you protect your investment by obfuscation .
Anyhow, thanks a lot for this great and quick help! No I can start to write my LogMX "AutoConfigParser" using version 1.2.6...
LogMX is a cool tool, even better than Chainsaw; at least in my opinion.
Even the eval version gives a good overview about what is possible and buying the professional version the user has really a great tool!
Thanks.
--Klaus