PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

[Enhancement] - Write the logs into external log file.

Open abiran opened this issue 10 years ago • 8 comments

It would be a great idea to write the logs into external file for those persons who want to catch some particular message and are not able due the terminal has a limit of lines to display. Or for those persons who runs the bot as background service with tmux or screen on his local or in a cloud server like digitalocean.

abiran avatar Aug 13 '16 22:08 abiran

I use this command when running bot on my Raspberry Pi

run bot in background and create a log file named pogobot.log nohup ./run.sh >pogobot.log &

run bot in background without creating log nohup ./run.sh >/dev/null 2>&1 &

view log file tail -f pogobot.log

emperium76 avatar Aug 14 '16 00:08 emperium76

Any idea what the windows commands for this would be? @emperium76

Trico3 avatar Aug 14 '16 02:08 Trico3

There are OS specific workarounds and seeing as you ignored the issue template which indicates what OS you're using it's hard to assist you with this. Going to mark it as a new feature to allow OS agnostic external logging

k4n30 avatar Aug 14 '16 02:08 k4n30

Please move your feature request/s to our feature hub - http://feathub.com/PokemonGoF/PokemonGo-Bot

Edit: Feathub may be turned off in favour of better GitHub tags, issue templates, and voting structures. Please feel free to continue using this issue (but don't delete the Feathub request just yet)

k4n30 avatar Aug 14 '16 03:08 k4n30

I modified run.sh to split output... unix specific though.

  stamp=`date +%s`
  python pokecli.py --config ${config} 2>&1 | tee logs/botlog-${stamp}.txt

raxxon avatar Aug 14 '16 06:08 raxxon

here's what i did to mine:

#[       cli]         pokecli.py line 62    
handler = logging.FileHandler('bot_console.log')
handler.setFormatter(logging.Formatter('%(asctime)s [%(name)10s] [%(levelname)s] %(message)s'))
if not len(logger.handlers):
    logger.addHandler(handler)

#[PokemonGoBot]       pokemongo_bot/__init__.py line 73
#[IncubateEggs]       pokemongo_bot/incubate_eggs.py line 18
#[PokemonCatchWorker] pokemongo_bot/pokemon_catch_worker.py line 44
import logging
...
self.logger = logging.getLogger(type(self).__name__)
handler = logging.FileHandler('bot_console.log')
handler.setFormatter(logging.Formatter('%(asctime)s [%(name)10s] [%(levelname)s] %(message)s'))
if not len(self.logger.handlers):
    self.logger.addHandler(handler)

carlosesteban avatar Aug 14 '16 12:08 carlosesteban

https://github.com/PokemonGoF/PokemonGo-Bot/issues/3843#issuecomment-239708680

k4n30 avatar Aug 15 '16 00:08 k4n30

#2729

k4n30 avatar Aug 16 '16 05:08 k4n30