So in a console .Net application I can watch all my log4net events stream by with (the powershell command) get-content .\log.log -Wait which is similar to the linux tail command and I assume uses FileSystemWatcher under the hood.
For some reason, whenever I have an asp.net Mvc application this will not work. To be clear, the log file IS written to. I can get-content .\log.log as many times as I want and get the most recent results, but with the -wait parameter I never see the changes scroll past.
Does anyone have any insight into what might be going on here?
UPDATE: found a working solution for my case, not sure whether this would help you out.
Instead of using PowerShell, I downloaded win-bash and now I'm using this familiar Unix command which works perfectly for me.
tail -f access.log
I'm not that familiar with .Net programming. Could it be a working solution in your case to use win-bash project's bash.exe instead of PowerShell?
I am experiencing similar issue when trying to "tail" Apache access log in PowerShell.
Get-Content .\access.log -Wait
I noticed that when my Apache HTTP server is running, it has a handle open to acccess.log and -Wait doesn't work. Stopping HTTP server releases the handle and when I made manual changes to access.log using text editor my PowerShell window immediately reflected changes in the console.
So I assume if some other program has a handle open to the file, changes are not reflected to console. Unfortunately I haven't found a way around this issue so far.
Related
Having used robot framework for almost a year, it suddenly stopped working. Starting a script gives only the response
'pybot' is not recognized as an internal or external command, operable program or batch file.
Running scripts worked yesterday, and I can't remember making any changes since then. I have checked the environment variables, they haven't been changed. The installation is on a Windows Server 2012. Python is still working as usual. There is no difference between using pybot or robot.
Now I just don't know what else to look for, and I'm asking you geniuses to give some ideas on where to search for this error.
One of two things happened:
robot framework was uninstalled
something in your environment changed so that pybot is no longer on your PATH
Both of those should be very easy to verify.
It turns out that the python/scripts folder had been moved by someone into the python/Lib folder. Simply putting it back solved the issue.
I understood that anything to standard out (System.out) would appear in the Java Console window (when it's enabled). I spotted somewhere though that there might be situations where this isn't try, for example, from Swing apps. Is that the case?
Basically, what situations or setups wouldn't I expect to see standard output in the console? Is there a difference in behavior running on the JDK rather than explicitly on the JRE for example? javaw.exe?
ps, I understand how to display the Console in the Java settings but I'm curious as I've managed to create an application, run as an executable jar, that doesn't start the console despite some calls to System.out) on Windows 7.
The only way you wouldn't see System.out output in the console is if the method System.setOut has been invoked. This method is invoked to redirect output to the graphical Java Console, but I don't know of any other realistic circumstance in which it would be redirected away from the Java Console unless you do so voluntarily.
Depending on terminal settings it can happen that the output is not written until a newline character is sent as well. So if you do System.out.print("test") it might not appear immediately.
On Windows this is usually not the case, but on Unix terminals this is quite common.
Perhaps you use javaw to start virtual machine, this version will not show console messages. You can use java to start the virtual machine, which will show the console message.
javaw is intended for apps with windows, java is intended for console apps.
Same thing happened to me. I could not get System.out.println or Logger.debug either on console.
If you are on a huge project in Eclipse or whatever, you can read below.
Solution: I realized that I had not committed jars and some java files to SubVersioN on network. thats all. Project had not been compiled.
One situation I can think of is to invoke System.setOut(null) (orSystem.setOut(any OutputStream other than System.out or System.err)) then the console, if exists, would show nothing.
I have a small app that I'm trying to build against windows machines. The program creates an OpenVPN connection. If I build the program and run it it first opens a console as the program output. If I pass the -w parameter to pyinstaller to not build it with a console attached the program fails to run at all. It opens allright but the vpn connection is never created.
With the console everything works perfect.
I also have a basic logging for the application in place to see where my code might stop and nothing gets written. With console on my program spits out all kinds of logs.
I just don't know why my program could be performing perfectly with a console but doing nothing without one. Any ideas?
Gonna answer this myself. Make sure you don't print anything and also you redirect all stdout to a logger, file or whatever else instead of the console.
I was having a similar problem, but couldn't find any print/stdout statements going to console. I was using subprocess.Popen and redirecting stdout=subprocess.PIPE. I subsequently added stderr=subprocess.STDOUT and stdin=subprocess.PIPE and my program worked. This page (Python subprocess.call() fails when using pythonw.exe) on subprocess failures helped me get it working.
I am using Apache Solr for one of my Drupal sites. I start my Apache Solr with Java -Jar -Xmx256M start.jar to fix the memory limit. I run my Apache in screen, but at times i see that my instance of Apache solr gets stopped/killed automatically. In my dev server i find it very hard to start it manually. Is there any fix to stop the instance getting killed automatically?
By the way the following are some of the warning i get in the console
"solrconfig.xml: is deprecated and no longer recommended used."
"WARNING: and configuration sections are deprecated (but still work). Please use instead."
Thanks.
I had this problem initially as well. I solved it by starting a screen session as root and starting Solr within that session. Also try adding a nohup before the java command and see if that works.
I have an update function in my app - it downloads and verifies the installer (a setup.exe, created with NSIS). To actually kick off the update, I have simply been doing:
QString path = .. absolute path to the downloaded file ...
QProcess::startDetached(path, QStringList());
This works fine on XP - but on Vista and Win7, nothing happens once the download completes. If I browse to the downloaded update and run it manually, it works fine. I assume what's happening is that UAC is blocking the installer at CreateProcess time, but this is where my knowledge runs out.
Additional complication - when I'm running a debug build from the command line, the steps above work - I get the UAC prompt and can run the installer. It's the release builds, started form the start menu/shortcut, which have the issue - I assume there's a difference in the auth token when running from a command shell.
You can also use
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
Might be surprising and counterintuitive, but it works and is more cross-platform
If you are not admin and you call CreateProcess() on a .exe with a "Vista" manifest (or no manifest, but a .exe that windows detects as an installer (This includes NSIS)) the call fails, you need to use ShellExecute[Ex](). ShellExecute will trigger UAC prompt if required...
This seems to be a Qt bug, see QTBUG-9761 , the correct workaround is to use ShellExecute with lpOperation set to runas.
Another alternative is to prepend your execution with cmd.exe /C. This effectively routes your execution through the shell, so you do get the UAC prompt. The downside is that if your process fails you probably won't get as much information had you gone through ShellExecute[Ex], but on the plus side you will get all the facilities of QProcess that you miss if you use QDesktopServices::openUrl, where you have no idea if things worked or not.