Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 18 13:42

    darkfrog26 on 2.7.10

    (compare)

  • Sep 18 13:42

    darkfrog26 on master

    Release 2.7.10 (compare)

  • Sep 18 01:15

    darkfrog26 on master

    Updated to latest version of pe… (compare)

  • Sep 14 15:05
    fdietze commented #117
  • Sep 14 14:15
    darkfrog26 closed #117
  • Sep 14 14:15
    darkfrog26 commented #117
  • Aug 07 23:28
    darkfrog26 commented #117
  • Aug 07 20:33
    fdietze opened #117
  • Jul 29 20:59
    Daenyth commented #105
  • Jul 29 17:29
    darkfrog26 commented #105
  • Jul 29 16:46
    zchbndcc9 commented #105
  • Jul 25 16:31
    Daenyth commented #105
  • Jul 25 16:17
    zchbndcc9 commented #116
  • Jul 25 12:49
    darkfrog26 commented #79
  • Jul 25 07:41
    david-bouyssie commented #79
  • Jul 25 01:20
    darkfrog26 commented #116
  • Jul 25 01:19
    darkfrog26 commented #79
  • Jul 24 17:00
    zchbndcc9 opened #116
  • Jul 24 14:48
    Daenyth commented #105
  • Jul 24 14:48
    Daenyth commented #105
Matt Hicks
@darkfrog26
hehe, fair enough
Andreas Joseph Krogh
@andreak
@darkfrog26 Can you confirm that this is the correct way to configure a "warning-logger" which should only log stuff in select()'ed packages with Level.Warn?
https://github.com/andreak/scribe-logleveltest/blob/master/src/test/scala/com/visena/logtest/ScribeLoggingTest.scala#L51
        val warnHandler = LogHandler(
            minimumLevel = Some(Level.Warn),
            writer = FileWriter()
                .path(_ => Paths.get(System.getProperty("user.home"),"logs", moduleName, "warn.log"))
                .rolling(LogPath.daily(prefix = "warn"
                    , directory = Paths.get(System.getProperty("user.home"), "logs", moduleName))
                ).autoFlush
        ).withModifier(
            select(
                packageName.startsWith("no.officenet"),
                packageName.startsWith("com.visena")
            ).include(level <= Level.Warn).excludeUnselected
        )
Matt Hicks
@darkfrog26
@andreak just warning, or warning above?
Andreas Joseph Krogh
@andreak
just warning
Matt Hicks
@darkfrog26
excludeUnselected will not log anything that doesn't start with those two package names
Andreas Joseph Krogh
@andreak
That's what I want
Matt Hicks
@darkfrog26
okay
Instead of include I would do: .exclude(level < Level.Warn).exclude(level > Level.Warn)
that include will log WARN and anything below it (INFO, TRACE, DEBUG, etc.)
Andreas Joseph Krogh
@andreak
Yea, but that's filtered out by LogHandler.minimumLevel = Some(Level.Warn)
Matt Hicks
@darkfrog26
true, but you could just remove minimumLevel then and the logic would be more clear
Andreas Joseph Krogh
@andreak
But it will carry extra overhead so I should filter it out before it gets to the handler?
Right
Thanks.
Matt Hicks
@darkfrog26
performance probably won't make a difference
Andreas Joseph Krogh
@andreak
But clarity wins:-)
siyan
@blazingsiyan
@darkfrog26 hi~ I am not familiar with the java file APIs, is there any possibility that MaxLogFilesAction will leak file handles?
I have an App used scribe, when I turn on FileWriter’s maxLogs, and use lsof -p to list the open files of the running process, the number is increasing, and all of the newly opened files are pointing to the log dir
siyan
@blazingsiyan
scribe version: 2.7.6
Matt Hicks
@darkfrog26
@blazingsiyan I'll do some checking
@blazingsiyan I'm not seeing anything standing out. If you're willing to do some additional diagnostics I'd be happy to assist where I can.
Matt Hicks
@darkfrog26
the likely leak would be in orphaned LogFile entries
that aren't disposed
siyan
@blazingsiyan
    Files
      .newDirectoryStream(directory)
      .iterator()
      .asScala
      .toList
      .filter(MatchLogAndGZ)
      .filter(_.getFileName.toString.startsWith(prefix))
      .sortBy(Files.getLastModifiedTime(_))
will this code auto close? :sweat_smile:
@darkfrog26 just repeat eval the above code, the open file will keep increasing
Matt Hicks
@darkfrog26
@blazingsiyan is that being done somewhere in Scribe?
I should be closing everything that gets opened when dispose is called
Matt Hicks
@darkfrog26
@blazingsiyan aha! Can you log a ticket for that and I'll get a look this week?
siyan
@blazingsiyan
@darkfrog26 sure
Matt Hicks
@darkfrog26
Scribe 2.7.7 is released (@blazingsiyan this includes your PR)
siyan
@blazingsiyan
@darkfrog26 thanks :smiley:
Binh Nguyen
@ngbinh
@darkfrog26 I am interested in having async log for cats-effects and monix, do you have any pointer on how to achieve that with scribe? I have seen scribe.future but I am not sure if it is the best route
Anthony Cerruti
@srnb_gitlab
If you want cats safe logging I would suggest looking at https://github.com/ChristopherDavenport/log4cats @ngbinh
You could probably raise an issue for a scribe backend
Binh Nguyen
@ngbinh
@srnb_gitlab thanks, will look into it
Matt Hicks
@darkfrog26
@ngbinh also, this might be worth looking at: outr/scribe#105
Binh Nguyen
@ngbinh
do you know where to find log4cats-scribe?Looks like it get moved out of the main log4cats but doesn't seem like I can find the Github repo for it
Andreas Joseph Krogh
@andreak

Hi.
Is it possible to log a message with timing-info, like passing a Long => String function like this?

    def debug[T](msg: Long => String, blockOfCode: => T): T = {
        val t0 = System.currentTimeMillis()
        try {
            blockOfCode
        } finally {
            val t1 = System.currentTimeMillis()
            debug(msg(t1 - t0))
        }
    }

Could be used like val result = debug(ms => s"Time retrieving results: $ms ms.", myService.retrieveResults())

Eder Ruiz
@drrzmr
I have a project with logback + slf4j working fine, All libraries log respecting logback format. I want use scribe to log my application stuff, there are some way to make scribe respect logback format?
Eder Ruiz
@drrzmr
Or is better remove logback from project and format with scribe?
Andreas Joseph Krogh
@andreak
Well, we use the following to route "all" to slf4j, then to scribe:
log4j-over-slf4j
jcl-over-slf4j
jul-to-slf4j
And then we use scribe-slf4j to have scribe log everything. Works great!
Andreas Joseph Krogh
@andreak
So, including slf4j-api and logback-classic should be sufficient if I understand it correctly, according to https://www.slf4j.org/manual.html
Matt Hicks
@darkfrog26
@andreak sorry for the delay in response...life has been crazy. I've created a new company around messaging (https://courio.com), so all my time has been occupied by that.
@andreak, I'm not sure I understand your timing question. In MDC there is elapsed that allows convenience functionality to log elapsed times for blocks in your logs automatically.
@drrzmr Scribe is meant to be a better logging library. As such, it's not built on other logging libraries (like practically every other library out there). While it would be possible to write code that honors logback config, if you migrate to Scribe, you gain great flexibility to programmatically do things in logging that nothing else can do.
Andreas Joseph Krogh
@andreak
@darkfrog26 I wasn't aware of MDC's elapsed. I'll look into it, thanks for the pointer.
@drrzmr My suggestion is based on when you have to cope with legacy-code/libs using other logging-libraries but you want to use Scribe. I use this apporach with great success.