run scrapy project without log

2,882 views
Skip to first unread message

klaus

unread,
Aug 31, 2011, 11:27:50 AM8/31/11
to scrapy...@googlegroups.com
Hi all,
how i can run a scrapy project without log? When i run the project with command scrapy crawl myproject it print all item and all degub log. 

Thank you so much 

Pablo Hoffman

unread,
Aug 31, 2011, 11:35:17 AM8/31/11
to scrapy...@googlegroups.com
scrapy crawl myspider --nolog

or to store log in a separate file:

scrapy crawl myspider --logfile=myspider.log

On Wed, Aug 31, 2011 at 08:27:50AM -0700, klaus wrote:
> Hi all,
> how i can run a scrapy project without log? When i run the project with

> command *scrapy crawl myproject* it print all item and all degub log.
>
> Thank you so much
>
> --
> You received this message because you are subscribed to the Google Groups "scrapy-users" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/scrapy-users/-/lPsZ3ymjPyUJ.
> To post to this group, send email to scrapy...@googlegroups.com.
> To unsubscribe from this group, send email to scrapy-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/scrapy-users?hl=en.
>

klaus

unread,
Aug 31, 2011, 11:54:44 AM8/31/11
to scrapy...@googlegroups.com
Thanks Pablo. When i don't use --log the spider print the debug/info message and print all item parsed. How i can disable the item parsed print?
Thanks

silent254

unread,
Aug 31, 2011, 12:13:38 PM8/31/11
to scrapy-users
In your settings.py, try setting LOG_ENABLED = False and see if that
is what you want?

SS

klaus

unread,
Aug 31, 2011, 3:05:14 PM8/31/11
to scrapy...@googlegroups.com
thanks silent, but this is not exactly that i want, this disable all log, similar to --nolog. I want print my debug line but i want don't print the item scraped.

Thanks

Rolando Espinoza La Fuente

unread,
Aug 31, 2011, 4:07:45 PM8/31/11
to scrapy...@googlegroups.com

You can override the LOG_FORMATTER setting to not display the whole
item content.
Other option is to use LOG_LEVEL=INFO and log your messages with level=INFO

Regards

~Rolando

silent254

unread,
Aug 31, 2011, 4:37:56 PM8/31/11
to scrapy-users
Rolando - you beat me to this ... I was going to suggest the same
thing for LOG_LEVEL=INFO.

SS

On Aug 31, 1:07 pm, Rolando Espinoza La Fuente <dark...@gmail.com>
wrote:

klaus

unread,
Sep 1, 2011, 4:19:14 AM9/1/11
to scrapy...@googlegroups.com
Thank you so much but this configuration is not defined. The error is: NameError: name 'INFO' is not defined.

Rolando Espinoza La Fuente

unread,
Sep 1, 2011, 9:41:26 AM9/1/11
to scrapy...@googlegroups.com
On Thu, Sep 1, 2011 at 4:19 AM, klaus <antoni...@gmail.com> wrote:
> Thank you so much but this configuration is not defined. The error
> is: NameError: name 'INFO' is not defined.

from command line? in the settings? when logging a message?

in settings you should use LOG_LEVEL="INFO"

when logging messages you should do:

from scrapy import log

log.msg("foo", level=log.INFO)

# in a spider's method

self.log("foo", level=log.INFO)

Regards

~Rolando

klaus

unread,
Sep 1, 2011, 5:19:47 PM9/1/11
to scrapy...@googlegroups.com
Ok Rolando, i used LOG_LEVEL=INFO and this code generate an error, with LOG_LEVEL="INFO" the code function right, the debug message are not printed. But the item that the code scrape and print are the info message and in my code i don't write any code for print this. How can i remove this print message? 

Rolando Espinoza La Fuente

unread,
Sep 1, 2011, 5:57:44 PM9/1/11
to scrapy...@googlegroups.com

Which scrapy version are you using? In latest version the scraped item print
has been moved to debug instead info level.

If you get the item printed in info level, changing the log level to
warning would work for you?

~Rolando


> --
> You received this message because you are subscribed to the Google Groups
> "scrapy-users" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/scrapy-users/-/rqQbkSigH0gJ.

klaus

unread,
Sep 2, 2011, 4:05:44 AM9/2/11
to scrapy...@googlegroups.com
Hi Rolando,
i use the Scrapy 0.12.0.2539. Today i'll try the log_level warnings and i'll let you know.

thanks
Reply all
Reply to author
Forward
0 new messages