You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Hesham G." <he...@gmail.com> on 2010/12/30 20:56:01 UTC

Disable logging

I know this has been asked before, but I can't find its answer yet !
I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the console, as it slows the code a lot while parsing the PDF.

How can I do this please ?


Best regards ,
Hesham

Re: Disable logging

Posted by "Hesham G." <he...@gmail.com>.
Emmm .. I am using log4j, so when initializing the class that parses the PDF file I did this :
Logger logger = Logger.getLogger(MyClass.class);

logger.setLevel( Level.OFF ); 



But nothing happened ! The logs are still printed. Here is part of it :

DEBUG - processing substream token: PDFOperator{TJ}

DEBUG - processing substream token: COSName{Span}

DEBUG - processing substream token: COSDictionary{(COSName{ActualText}:COSString{­}) }

DEBUG - processing substream token: PDFOperator{BDC}

DEBUG - processing substream token: COSFloat{27.146}

DEBUG - processing substream token: COSInt{0}



Best regards ,
Hesham


---------------------------------------------
Included message :

> You can get rid of most logging output by setting your log level to
> something higher than Debug.  There might still be a few things going to the
> console.
> 
> -Dave
> 
> On Thu, Dec 30, 2010 at 12:56 PM, Hesham G. <he...@gmail.com> wrote:
> 
>> I know this has been asked before, but I can't find its answer yet !
>> I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the
>> console, as it slows the code a lot while parsing the PDF.
>>
>> How can I do this please ?
>>
>>
>> Best regards ,
>> Hesham
>

Re: Disable logging

Posted by David Hoffer <dh...@gmail.com>.
You can get rid of most logging output by setting your log level to
something higher than Debug.  There might still be a few things going to the
console.

-Dave

On Thu, Dec 30, 2010 at 12:56 PM, Hesham G. <he...@gmail.com> wrote:

> I know this has been asked before, but I can't find its answer yet !
> I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the
> console, as it slows the code a lot while parsing the PDF.
>
> How can I do this please ?
>
>
> Best regards ,
> Hesham

Re: Disable logging

Posted by "Hesham G." <he...@gmail.com>.
Ken ,

With: .level=OFF
The printed line "Bad level value for property: .level" disappears, but 
still the logs of PDFBox are still printed !!

Best regards ,
Hesham


---------------------------------------------
Included message :


> My mistake for not reading carefully enough.  Andreas provided you with 
> java.util.logging machinery (JUL).  In that case, you want to set
>
> .level=OFF
>
> and consult
>
> http://download.oracle.com/javase/1.4.2/docs/api/java/util/logging/Level.html
> and
> http://download.oracle.com/javase/1.4.2/docs/guide/util/logging/overview.html
>
> --Ken
>
>
>
> On Dec 30, 2010, at 5:36 PM, Hesham G. wrote:
>
>> I am reading this now. But I always get this printed in console, even 
>> with "ERROR" or "FATAL" levels  :
>> Bad level value for property: .level
>>
>> And still the logs are printed !!!
>>
>>
>> Best regards ,
>> Hesham
>>
>> ---------------------------------------------
>> Included message :
>>
>>
>>> Changing the level in the logging.properties file will help, from
>>>
>>> .level=INFO
>>>
>>> to say to something like:
>>>
>>> .level=WARN
>>> or
>>> .level=ERROR
>>>
>>> Check out the tutorial at 
>>> http://logging.apache.org/log4j/1.2/manual.html
>>>
>>> --Ken
>>>
>>> On Dec 30, 2010, at 4:40 PM, Hesham G. wrote:
>>>
>>>> Thanks Andreas.
>>>>
>>>> I have put the properties file you attached in my application root 
>>>> path, and I started the application with the argument :
>>>> -Djava.util.logging.config.file=logging.properties
>>>>
>>>> But it still prints the logs! Is there something missing ?
>>>>
>>>> Best regards ,
>>>> Hesham
>>>>
>>>> ---------------------------------------------
>>>> Included message :
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> Am 30.12.2010 20:56, schrieb Hesham G.:
>>>>>> I know this has been asked before, but I can't find its answer yet !
>>>>>> I am upgrading to PDFBox v1.4 and I need to disable the logs printed 
>>>>>> in the console, as it slows the code a lot while parsing the PDF.
>>>>>>
>>>>>> How can I do this please ?
>>>>> You have to specify the properity file using the following parameter
>>>>>
>>>>> -Djava.util.logging.config.file=logging.properties
>>>>>
>>>>> PDFBox includes a sample property file, see [1] for further 
>>>>> information.
>>>>>
>>>>> BR
>>>>> Andreas Lehmkühler
>>>>>
>>>>> [1]
>>>>> http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/test/resources/logging.properties
>>>>>
>>>
>>>
>
> 

Re: Disable logging

Posted by Ken Bowen <kb...@als.com>.
My mistake for not reading carefully enough.  Andreas provided you with java.util.logging machinery (JUL).  In that case, you want to set

.level=OFF

and consult

http://download.oracle.com/javase/1.4.2/docs/api/java/util/logging/Level.html
and
http://download.oracle.com/javase/1.4.2/docs/guide/util/logging/overview.html

--Ken



On Dec 30, 2010, at 5:36 PM, Hesham G. wrote:

> I am reading this now. But I always get this printed in console, even with "ERROR" or "FATAL" levels  :
> Bad level value for property: .level
> 
> And still the logs are printed !!!
> 
> 
> Best regards ,
> Hesham 
> 
> ---------------------------------------------
> Included message :
> 
> 
>> Changing the level in the logging.properties file will help, from
>> 
>> .level=INFO
>> 
>> to say to something like:
>> 
>> .level=WARN
>> or
>> .level=ERROR
>> 
>> Check out the tutorial at http://logging.apache.org/log4j/1.2/manual.html
>> 
>> --Ken
>> 
>> On Dec 30, 2010, at 4:40 PM, Hesham G. wrote:
>> 
>>> Thanks Andreas.
>>> 
>>> I have put the properties file you attached in my application root path, and I started the application with the argument :
>>> -Djava.util.logging.config.file=logging.properties
>>> 
>>> But it still prints the logs! Is there something missing ?
>>> 
>>> Best regards ,
>>> Hesham 
>>> 
>>> ---------------------------------------------
>>> Included message :
>>> 
>>> 
>>>> Hi,
>>>> 
>>>> Am 30.12.2010 20:56, schrieb Hesham G.:
>>>>> I know this has been asked before, but I can't find its answer yet !
>>>>> I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the console, as it slows the code a lot while parsing the PDF.
>>>>> 
>>>>> How can I do this please ?
>>>> You have to specify the properity file using the following parameter
>>>> 
>>>> -Djava.util.logging.config.file=logging.properties
>>>> 
>>>> PDFBox includes a sample property file, see [1] for further information.
>>>> 
>>>> BR
>>>> Andreas Lehmkühler
>>>> 
>>>> [1] 
>>>> http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/test/resources/logging.properties
>>>> 
>> 
>> 


Re: Disable logging

Posted by "Hesham G." <he...@gmail.com>.
I am reading this now. But I always get this printed in console, even with "ERROR" or "FATAL" levels  :
Bad level value for property: .level

And still the logs are printed !!!


Best regards ,
Hesham 

---------------------------------------------
Included message :


> Changing the level in the logging.properties file will help, from
> 
> .level=INFO
> 
> to say to something like:
> 
> .level=WARN
> or
> .level=ERROR
> 
> Check out the tutorial at http://logging.apache.org/log4j/1.2/manual.html
> 
> --Ken
> 
> On Dec 30, 2010, at 4:40 PM, Hesham G. wrote:
> 
>> Thanks Andreas.
>> 
>> I have put the properties file you attached in my application root path, and I started the application with the argument :
>> -Djava.util.logging.config.file=logging.properties
>> 
>> But it still prints the logs! Is there something missing ?
>> 
>> Best regards ,
>> Hesham 
>> 
>> ---------------------------------------------
>> Included message :
>> 
>> 
>>> Hi,
>>> 
>>> Am 30.12.2010 20:56, schrieb Hesham G.:
>>>> I know this has been asked before, but I can't find its answer yet !
>>>> I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the console, as it slows the code a lot while parsing the PDF.
>>>> 
>>>> How can I do this please ?
>>> You have to specify the properity file using the following parameter
>>> 
>>> -Djava.util.logging.config.file=logging.properties
>>> 
>>> PDFBox includes a sample property file, see [1] for further information.
>>> 
>>> BR
>>> Andreas Lehmkühler
>>> 
>>> [1] 
>>> http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/test/resources/logging.properties
>>> 
> 
>

Re: Disable logging

Posted by Ken Bowen <kb...@als.com>.
Changing the level in the logging.properties file will help, from

.level=INFO

to say to something like:

.level=WARN
or
.level=ERROR

Check out the tutorial at http://logging.apache.org/log4j/1.2/manual.html

--Ken

On Dec 30, 2010, at 4:40 PM, Hesham G. wrote:

> Thanks Andreas.
> 
> I have put the properties file you attached in my application root path, and I started the application with the argument :
> -Djava.util.logging.config.file=logging.properties
> 
> But it still prints the logs! Is there something missing ?
> 
> Best regards ,
> Hesham 
> 
> ---------------------------------------------
> Included message :
> 
> 
>> Hi,
>> 
>> Am 30.12.2010 20:56, schrieb Hesham G.:
>>> I know this has been asked before, but I can't find its answer yet !
>>> I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the console, as it slows the code a lot while parsing the PDF.
>>> 
>>> How can I do this please ?
>> You have to specify the properity file using the following parameter
>> 
>> -Djava.util.logging.config.file=logging.properties
>> 
>> PDFBox includes a sample property file, see [1] for further information.
>> 
>> BR
>> Andreas Lehmkühler
>> 
>> [1] 
>> http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/test/resources/logging.properties
>> 


Re: Disable logging

Posted by "Hesham G." <he...@gmail.com>.
Thanks Andreas.

I have put the properties file you attached in my application root path, and I started the application with the argument :
-Djava.util.logging.config.file=logging.properties

But it still prints the logs! Is there something missing ?

Best regards ,
Hesham 

---------------------------------------------
Included message :


> Hi,
> 
> Am 30.12.2010 20:56, schrieb Hesham G.:
>> I know this has been asked before, but I can't find its answer yet !
>> I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the console, as it slows the code a lot while parsing the PDF.
>>
>> How can I do this please ?
> You have to specify the properity file using the following parameter
> 
> -Djava.util.logging.config.file=logging.properties
> 
> PDFBox includes a sample property file, see [1] for further information.
> 
> BR
> Andreas Lehmkühler
> 
> [1] 
> http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/test/resources/logging.properties
>

Re: Disable logging

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 30.12.2010 20:56, schrieb Hesham G.:
> I know this has been asked before, but I can't find its answer yet !
> I am upgrading to PDFBox v1.4 and I need to disable the logs printed in the console, as it slows the code a lot while parsing the PDF.
>
> How can I do this please ?
You have to specify the properity file using the following parameter

-Djava.util.logging.config.file=logging.properties

PDFBox includes a sample property file, see [1] for further information.

BR
Andreas Lehmkühler

[1] 
http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/test/resources/logging.properties