jpelzer / pelzer-util Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
If the OFields doesn't know how to handle a particular field type, try to use gson and deserialize the string into an object.
This call is not really meant to be used regularly, but it should announce to the logs when it has been.
AbstractLoggingStrategy added a new method signature for addLoggerFieldToClass, so compilation fails.
StopWatch class needs a way to be instantiated and started in one call.
Suggestions:
either via constructor
StopWatch(boolean start)
or via a static factory method:
StopWatch.createStarted()
Thanks!
It should be possible to add a threadlocal property to the core Logging class that will, when present, output a string to every entry logged for that thread.
The following code causes Groovy compilation to puke:
package com.pelzer.util
@Log
class GroovyLoggingTest {
void groovyASTErrorTest() {
def regularString = "I'm a regular groovy string"
def stringWithEnum = "I'm a regular groovy-style string, with an enum in me. $Foo.FOO"
// These lines go through without issue
log.debug("I'm a log statement that causes no problem.")
log.debug(stringWithEnum)
// The following lines cause the compiler to poop the bed.
log.debug("I have another string in me: $regularString")
log.debug("$stringWithEnum")
log.debug("I cause the Groovy compiler to poop the bed $Foo.FOO")
log.debug("I also cause the Groovy compiler to poop the bed {}", Foo.FOO)
}
enum Foo {
FOO, BAR, JAR
}
}
This has something to do with the isDebugEnabled or isInfoEnabled calls, as it doesn't happen for warn, error, or fatal logs. It is the enum that triggers it, as far as I can tell. Here's a stacktrace:
Groovyc: java.lang.NullPointerException
at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:273)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:178)
at org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression.java:76)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:131)
at org.codehaus.groovy.control.StaticVerifier.visitMethodCallExpression(StaticVerifier.java:78)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:64)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBooleanExpression(CodeVisitorSupport.java:166)
at org.codehaus.groovy.ast.expr.BooleanExpression.visit(BooleanExpression.java:40)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitTernaryExpression(CodeVisitorSupport.java:148)
at org.codehaus.groovy.ast.expr.TernaryExpression.visit(TernaryExpression.java:43)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:69)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:193)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:163)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
at org.codehaus.groovy.control.StaticVerifier.visitConstructorOrMethod(StaticVerifier.java:72)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1055)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
at org.codehaus.groovy.control.StaticVerifier.visitClass(StaticVerifier.java:41)
at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:201)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1036)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:572)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527)
at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:54)
at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:80)
at org.jetbrains.groovy.compiler.rt.GroovycRunner.main(GroovycRunner.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:121)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.