groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raviteja Lokineni <raviteja.lokin...@gmail.com>
Subject Re: Reporting groovy line number in log4j2
Date Wed, 24 Aug 2016 18:36:10 GMT
I have added logging(log4j2) in a groovy class which has the following
pseudo code:

This returns line number -1:
GParsPool.withPool {
    <collection>.eachParallel {
        //do something
        log.debug("<message>")
    }
}

The following also returns -1, although this doesn't seem to be in any
closure:
private void doProcess(<params>) {
    log.debug("<message>")
}

I take my word on grails back. It also returns -1 for line number.
Grails Example:

package com.sample

class SampleController {

    def index() {
        log.error("test")
        render "test"
    }
}


ERROR grails.app.controllers.com.sample.SampleController
g.a.c.com.sample.SampleController.call(-1)
- test

Thanks,
Raviteja

On Mon, Aug 22, 2016 at 4:40 PM, Paul King <paulk@asert.com.au> wrote:

> We set the line number to -1 for generated code which doesn't have a
> corresponding real line in the source code.
>
> So, you might be seeing exactly what we expect or it's possible we have
> missed some case. Can you elaborate further on how you are using the
> logging?
>
> Cheers, Paul.
>
> On Tue, Aug 23, 2016 at 6:00 AM, Raviteja Lokineni <
> raviteja.lokineni@gmail.com> wrote:
>
>> Hi all,
>>
>> Log4j ouputs groovy class line number to be -1. Any known fix/workaround
>> for this issue? I looked around a bit but found nothing. FYI, Grails team
>> doesn't seem to have this issue.
>>
>> Log4j patern: %d{yyyy-MM-dd HH:mm:ss.SSS(XXX)} [%t] %p %c:%L - %m%n
>>
>> Sample output I get:
>> <time> [<thread>] <LEVEL> <class>:*-1* - <message>
>>
>> Thanks,
>> --
>> *Raviteja Lokineni* | Business Intelligence Developer
>> TD Ameritrade
>>
>> E: raviteja.lokineni@gmail.com
>>
>> [image: View Raviteja Lokineni's profile on LinkedIn]
>> <http://in.linkedin.com/in/ravitejalokineni>
>>
>>
>


-- 
*Raviteja Lokineni* | Business Intelligence Developer
TD Ameritrade

E: raviteja.lokineni@gmail.com

[image: View Raviteja Lokineni's profile on LinkedIn]
<http://in.linkedin.com/in/ravitejalokineni>

Mime
View raw message