Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: View content of Log::Log4perl log file while logger is running

by taint (Chaplain)
on Dec 08, 2013 at 09:41 UTC ( #1066200=note: print w/replies, xml ) Need Help??


in reply to View content of Log::Log4perl log file while logger is running

Unless I've misunderstood your question. You're not going to be able to view the log file, until the system has completely flushed the file to disk, and released the filehandle. So that your app can parse it for reading.

Best wishes.

--Chris

Hey. I'm not completely useless. I can be used as a bad example.
  • Comment on Re: View content of Log::Log4perl log file while logger is running

Replies are listed 'Best First'.
Re^2: View content of Log::Log4perl log file while logger is running
by iseif (Novice) on Dec 08, 2013 at 10:30 UTC
    Thanks a lot for your replay. There is no way to 'view the file'? not opening it? for example, in Notepad++ we can open a file while Notepad is updating it - the notepad++ will tell us that the content of the file has been updated. I need to show the file content to the user and when he reload the page (F5) then we will see the new updated file.
      Well. I seem to be having a bit of difficulty following you completely.

      If I understand you correctly. You'd be likening it to opening an already created log file in your favorite editor. Then, refreshing the editor's view. Will show any additions/subtractions that may have occurred. Yes?

      If that's the case, you should be able to open an already created log file. Providing that the system is not already using it. In other words, as I stated before; if your system is either opening, writing, or otherwise, has it open for processing. You will NOT be able to open it, UNTIL the system has finished closing it. That's the way it works -- and for good reason. That's how you prevent data corruption.

      If you can get handle on the file, before the system does. You can maintain that handle, and refresh the view of that file, to see if there have been any changes. But to do that. You will need to create temp variable, that holds your current view. Thereby releasing the original file handle for other processes (whatever process is logging to log file you're viewing). So that, like you're viewing the file. They can write to it.

      Is this helping. Do you understand better how the whole process works? Did I understand your question correctly?

      Best wishes.

      --Chris

      Hey. I'm not completely useless. I can be used as a bad example.
      

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1066200]
help
Chatterbox?
[LanX]: Wilkes left the computer field in 1972 to attend the Harvard Law School
[erix]: too many stubborn, illogical men in IT
LanX "We had the quaint notion at the time that software should be completely, absolutely free of bugs. Unfortunately it's a notion that never really quite caught on." :)
[LanX]: erix Silence, I sue you!
[erix]: She sounds like Dijkstra (you know, Edsger)
LanX will call his fifth son "Edsger"

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-12-12 16:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (335 votes). Check out past polls.

    Notices?