GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support logging using `robot.api.logger` and `logging` APIs · Issue #26 · robotframework/PythonRemoteServer

Support logging using robot.api.logger and logging APIs #26

New issue
Copy link
New issue
Copy link
Open
Open
Support logging using robot.api.logger and logging APIs#26
Copy link
Labels
enhancement

Description

@vkruoso
vkruoso
opened on Jul 2, 2015
Issue body actions

It would be a nice feature to have if you could have a library that uses the robot.api.logger to log messages to just work when used in a remote server using the PythonRemoteServer.

Activity

  1. VernonCrabtree commented on Jul 14, 2015

    @VernonCrabtree
    VernonCrabtree
    on Jul 14, 2015
    More actions

    I am looking for this 'feature' too. It seems very strange not to support Robots own logging in a Robot server.
    I know python "print" output is picked up.
    But, as an example, I run the OperatingSystem Copy File keyword, but the INFO message gets lost on the remote system somewhere. This needs to be reported back to the output of the calling script.
    I tried registering my own logger in my remote library as follows:
    class RFremoteLogger(Logger): # Inherit from robot.output.logger.Logger
    def message(self, record):
    print record
    . . .
    if name == 'main':
    from robotremoteserver import RobotRemoteServer
    LOGGER.register_logger(RFremoteLogger)
    RobotRemoteServer(MyRemoteLib(), *sys.argv[1:])

    But this didn't work. No error, but also no output. I tried some other variations but no luck.
    Any suggestions how to get the output?

  2. VernonCrabtree commented on Jul 15, 2015

    @VernonCrabtree
    VernonCrabtree
    on Jul 15, 2015
    More actions

    For anyone else coming here: I solved it with this bit of code in my remote library:

    from robot.api import logger

    def remote_log_message(message,level,html=False):
    print '{} {}'.format(level, message)

    logger.write = remote_log_message

    This works because most Robot libraries import logger from robot.api - where we replace the definition of write.

  3. swordfly commented on Dec 7, 2016

    @swordfly
    swordfly
    on Dec 7, 2016
    More actions

    @VernonCrabtree Thank you, it's really a easy and best solution.

  4. pekkaklarck commented on Jan 9, 2017

    @pekkaklarck
    pekkaklarck
    on Jan 9, 2017
    Member
    More actions

    Yep, official support for robot.api.logger as well as for Python's logging module would be nice.

  5. pekkaklarck
    added
    enhancement
    on Jan 9, 2017
  6. pekkaklarck
    changed the title [-]Support robot.api.logger when running remote keywords[/-] [+]Support logging using `robot.api.logger` and `logging` APIs[/+] on Jan 9, 2017
  7. pekkaklarck
    added a commit that references this issue on Jan 10, 2017

    Update README to 1.1 level.

    7c95dd9
  8. conrados commented on Jun 6, 2019

    @conrados
    conrados
    on Jun 6, 2019
    More actions

    @VernonCrabtree : works like a charm. Nice workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.