GithubHelp home page GithubHelp logo

Comments (12)

darkfrog26 avatar darkfrog26 commented on September 26, 2024 1

Hmm, I'll have to take a look and do some testing. Feel free to create a PR here: https://github.com/outr/perfolation if you're interested in helping fix it.

from scribe.

megri avatar megri commented on September 26, 2024

Noticed two things:

  • This is a transitive issue from perfolation
  • Setting java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("UTC")) gives me the desired behaviour, but as a JVM-wide global it's quite scary to set.. 😬

from scribe.

megri avatar megri commented on September 26, 2024

A better solution perhaps would be to add the zone offset at the end of the string according to ISO8601-standards 🤔

from scribe.

darkfrog26 avatar darkfrog26 commented on September 26, 2024

Can you clarify which log formatting you are using?

from scribe.

darkfrog26 avatar darkfrog26 commented on September 26, 2024

Also, are you logging on JVM, JS, or Native?

from scribe.

megri avatar megri commented on September 26, 2024

Can you clarify which log formatting you are using?
Also, are you logging on JVM, JS, or Native?

Using FormatBlock.Date.ISO8601on JVM, although I'm assuming the outcome should be identical across all platforms.

from scribe.

darkfrog26 avatar darkfrog26 commented on September 26, 2024

It should be, but the implementations are different.

from scribe.

darkfrog26 avatar darkfrog26 commented on September 26, 2024

Correct me if I'm wrong here, but the problem isn't Perfolation; it's that I'm hard-coding Z on the end of the formatted stamp when it's local time. Would it be acceptable to just fix the suffix to output the proper timezone? Then, if you want to use UTC you can set the default timezone, or just leave the default and it will be the machine's local zone.

from scribe.

darkfrog26 avatar darkfrog26 commented on September 26, 2024

my proposed solution is just to replace "Z" in FormatBlock:74 to be ${l.t.Z}

from scribe.

darkfrog26 avatar darkfrog26 commented on September 26, 2024

@megri please let me know if this solution is acceptable to you.

from scribe.

megri avatar megri commented on September 26, 2024

@darkfrog26 I wasn't paying attention to this. I'm sorry. Fixing the output to use the proper timezone would definitely be preferable.

my proposed solution is just to replace "Z" in FormatBlock:74 to be ${l.t.Z}

That would be great. Note I tried reading up on how to properly format this but my reference actually doesn't seem to acknowledge this format. It's definitely better than hard-coding a Z though.

As an aside I tried using ${l.t.z} to get a zone offset — which IS mentioned in the reference — but it seems the implementation is broken as I got output looking like 2024-05-02T14:09:43 +-2-120 [INFO] <empty>.JGit.JGit:37 - this is a test!

from scribe.

megri avatar megri commented on September 26, 2024

This works though:

 val z =
    val ms = l.t.timeZoneOffsetMillis
    val sign = if ms < 0 then "-" else "+"
    val HH = Math.abs(ms) / 3600000
    val MM = Math.abs(ms) / 60000 % 60
    f"$sign$HH%02d$MM%02d"

from scribe.

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.