Giter Club home page Giter Club logo

tailf's Introduction

tailf's People

Contributors

alaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tailf's Issues

StackOverflowError: FollowingInputStream.handle

Ran into a StackOverflowError while letting this tail a file for a while (over 10 min). Log file was idle the entire time.

Exception in thread "Thread-10" java.lang.StackOverflowError
    at sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:253)
    at com.osinka.tailf.FollowingInputStream.rotated_$qmark(Tail.scala:104)
    at com.osinka.tailf.FollowingInputStream.handle(Tail.scala:109)
at com.osinka.tailf.FollowingInputStream.handle(Tail.scala:112)
    at com.osinka.tailf.FollowingInputStream.handle(Tail.scala:112)
    at com.osinka.tailf.FollowingInputStream.handle(Tail.scala:112)
    at com.osinka.tailf.FollowingInputStream.handle(Tail.scala:112)
    at com.osinka.tailf.FollowingInputStream.handle(Tail.scala:112)

followed by a ton of FollowingInputStream.handle lines. There are a total of 1020 of the following lines in the stacktrace:
at com.osinka.tailf.FollowingInputStream.handle(Tail.scala:112)

Full stacktrace here: http://pastebin.com/YEyrWnFv

Using Java 1.6u45 and Scala 2.10.4

I called Tail like this

    def read(r: BufferedReader): Unit = {
        if (!Thread.currentThread().isInterrupted) {
            val l = r.readLine
            if (l != null) {
                log.info(s"read line: $l")
            }
            read(r)
        } else {
            r.close()
            log.info("read() Shutdown!")
        }
    }

val file: File = new File(logFile)
val r = new BufferedReader(new InputStreamReader(Tail.follow(file)))
val readerThread = new Thread(new Runnable {
                def run() {
                    read(r)
                }
            })

readerThread.setDaemon(true)
readerThread.start()

What is this tailing for ?

Hi Alex,

I can't figure out what is this good for. It allows for surviving log rotation and still keep the handle to the log file that is backed up. But at that point it makes no sense to keep reading such file, right ?

Wouldn't it make more sense if it was able to continue with reading the new file that was created after the old was rotated? So that it could feel like it is reading one file but actually it would be xth file that it is reading after surviving rotation.

Thank you, Jakub

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.