Git Product home page Git Product logo

Comments (5)

tmakatos avatar tmakatos commented on August 10, 2024

Currently we require the the user to specify a log function. Typically the user will implement a log function that writes to a file. This can be useful for redirecting log messages to a single place that contains messages for a particular VM from other processes. However, logging to a file can block because the file system might be busy. I propose to allow the current behavior (assuming that the user knows what they're doing), but discourage it by providing a default implementaton for the log function that is automatically used if the user doesn't provide one. This function should log using syslog(3) and the log message should be prefixed with some ID provided by the user (this can be the socket path or some new string the user provides when lm_ctx is creared). We can also drop our custom LM_ERR/INF/DBG defines and switch to the ones provided from syslog(3).

@jlevon @swapnili thoughts?

from libvfio-user.

jlevon avatar jlevon commented on August 10, 2024

I'm not really clear why writing to disk is a problem: we shouldn't be generating logs in the fast path anyway (except for when debug's enabled, in which case it doesn't matter). As you say syslog is a pain for separating things out.

Either way we can use syslog's defines though.

from libvfio-user.

tmakatos avatar tmakatos commented on August 10, 2024

You're right in that we generally shouldn't be generating logs, however, if we run into some problem where the guest constantly sends requests that fail, we'll be logging. If this happens then we'll end up logging to the disk, and this can block. I've learned this the hard way.

from libvfio-user.

jlevon avatar jlevon commented on August 10, 2024

We can't let an untrusted client create arbitrary amounts of logging anyway (we might want an explicit function for that, not sure). But I take your point.

How about we default to stdout/stderr - this can actually be the right choice in many circumstances. We'll provide a way to use syslog instead, or the user can specify their own logger too as you mention.

from libvfio-user.

tmakatos avatar tmakatos commented on August 10, 2024

Logging to stdout/stderr by default sounds the sensible thing to do.

from libvfio-user.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.