I have a sbt project that uses Play 2.2 as a dependency. When a program is run in the console, only ERROR level messages show up. How do you change the level so INFO, DEBUG levels are printed?
example ERROR level output:
18:36:22.388 [run-main-1] ERROR application - Message
18:36:22.389 [run-main-1] ERROR application - Message
Try this:
Check if play application logging level is set properly:
You can override log levels in application.conf as follows:
# Root logger:
logger.root=DEBUG
for more detailed information see this article: Play 2.2 logging configuration
also be sure that your sbt has proper logging level:
$ sbt --debug
for more detailed information see this article: sbt 13.2 logging configuration
Related
I am adding Kamon to my spray project. I have added traceName directive and followed the instructions here - http://kamon.io/integrations/logback/trace-token-converter/ Where would one suggest start creating the context via Tracer.withNewContext("simple-test") ?
I had started out using the sbt revolver when I saw some threads related to not starting the context properly (See here). I would keep seeing the following line:
a4-dispatcher [WARN] [12/05/2015 10:12:55.967] [Dispatcher-akka.actor.default-dispatcher-3] [SprayExtension(akka://kamon)] EmptyTraceContext present while closing the trace with token [hostname.local-1]
I stopped using sbt revolver - and now I don't see that line and I see X-Trace-Token in the response header (which is awesome). But, I don't see the token in the logs. The %token is still undefined as defined in the LogbackTraceTokenConverter
Second question: could I be having competing Kamon libraries? I have kamon core, scala, akka, akka-remote, and spray in my build.sbt .
There are a few things that need to be in place
Start Kamon process using AspectJ. See http://kamon.io/introduction/get-started/
Sbt revolver won't get the tracing information right. It may be because the aspectj weaver doesn't get weaved in the forked JVM.
Console logging is still not working for me. The closest I could find is this thread - https://groups.google.com/d/msg/kamon-user/uipptjm24gk/OxrbvMw_6EYJ
I have a sbt project written in scala. The project uses akka and spray. There is a class with main function. When I run scala console application sometimes I get
[on-spray-can-akka.actor.default-dispatcher-4] [DEBUG] [2014-11-07 16:48:30,336] Sigar: no sigar-amd64-winnt.dll in java.library.path
org.hyperic.sigar.SigarException: no sigar-amd64-winnt.dll in java.library.path
I do not change anything run it again and it runs well. So it can be run successful or fail several times on end. How to fix this?
UPDATED
Also when it start normal there is a message:
[INFO] [11/07/2014 17:02:36.772] [on-spray-can-akka.actor.default-dispatcher-2]
[Cluster(akka://myApp)] Cluster Node [akka.tcp://myApp#127.0.0.1:2551] - Metrics will be
retreived from MBeans, and may be incorrect on some platforms. To increase metric accuracy
add the 'sigar.jar' to the classpath and the appropriate platform-specific native libary to
'java.library.path'. Reason: java.lang.IllegalArgumentException: java.lang.UnsatisfiedLinkError:
org.hyperic.sigar.Sigar.getPid()J
Sigar is a native library for gathering performance stats, used by Typesafe Console atmos Scala library. If you're not interested in hooking up Typesafe Console to your application, you can simply remove all references to atmos library from sbt build script and app config files without affecting your app functionality.
I'm using the sbt-idea plugin and in my metaproject and main project, I have a setting for logLevel := Level.Warn. This is effective at silencing all sub-warning messages from most of my build, but sbt-idea keeps printing out info messages.
I'm guessing that perhaps the plugin gets loaded before logLevel is applied, and it somehow gets a reference to a logger with a different level? The plugin in particular doesn't seem to be doing anything particularly funky about logging, except that it does seem to ask the state for its logger at initialization. It might end up being a different logger object from the one after my settings get applied?
I can't figure out what part of sbt actually consumes the logLevel setting key to see whether it creates a new logger or mutates the existing one.
Use --warn or --error before gen-idea.
$ sbt --warn gen-idea
or
$ sbt --error gen-idea
See Change the logging level globally for more up-to-date info (pun intended).
Be careful, though, as you may really miss infos after you silence the gen-idea command as it may take a while to complete and nothing gets printed out in the meantime.
It may hence be more useful to use another trick and execute warn or error commands before gen-idea.
$ sbt warn gen-idea
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Set current project to aaa (in build file:/Users/jacek/sandbox/stackoverflow/16256180/)
With this, you'll see something printed out on the console that may or may not be of some help.
default SBT log level is info (see http://code.google.com/p/simple-build-tool/wiki/RunningSbt).
How do I set it to warn as the default?
#Christian: Thanks! Did you get that to work? I modified the sbt.boot.properties accordingly and passed it via:
(1) -Dsbt.boot.properties=mysbt.boot.properties
(2) -jar /usr/local/Cellar/sbt/0.7.7/libexec/sbt-launch-0.7.7.jar "#/usr/local/Cellar/sbt/0.7.7/libexec/mysbt.boot.properties"
Both ways process my sbt.boot.properties but I still see [info] log messages. Overriding project settings does not work either.
I wonder if this works at all. I even found a bug.
Thanks,
Lars
You can set it temporarily by prefixing your action with warn, eg
~> sbt warn compile
or from the sbt console:
~> sbt
[info] Building project test 1.0 against Scala 2.8.1
[info] using TestProject with sbt 0.7.7 and Scala 2.7.7
> warn
Set log level to warn
> compile
>
In XSBT this seems to be the way to do it from the console
set logLevel in run := Level.Debug
https://github.com/harrah/xsbt/wiki/Quick-Configuration-Examples
Note that these are SBT levels, so for example they don't work directly with Play 2.0!
You could define it in sbt.boot.properties as explained here: sbt wiki
I am using Intellij IDEA 14.1.3 edition and have installed Scala plugin. When creating SBT project, it reports the following error:
Error:Error while importing SBT project:
...
::::::::::::::::::::::::::::::::::::::::::::::
:: org.fusesource.jansi#jansi;1.11: not found
::::::::::::::::::::::::::::::::::::::::::::::
:::: ERRORS
Server access Error: Connection timed out: connect url=http://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi/1.11/ivys/ivy.xml
Server access Error: Connection timed out: connect url=http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom
Server access Error: Connection timed out: connect url=http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.jar
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.fusesource.jansi#jansi;1.11: not found
Error during sbt execution: Error retrieving required libraries
(see C:\Users\xiaona\.sbt\boot\update.log for complete log)
Error: Could not retrieve jansi 1.11
See complete log in C:\Users\xiaona\.IdeaIC14\system\log\sbt.last.log
After referring this post, I see the root cause should be that I use proxy to connect internet.
But in SBT setting screen:
I can't find a place to set proxy. Where can I set proxy for SBT in Intellij IDEA?
Add -Dhttp.proxyHost=<proxy_server> -Dhttp.proxyPort=<proxy_port> to VM parameters
Read documentation for more info
Basically there are three ways of setting the proxy. Each of them seems to affect a different part of the IDE.
For all following three methods I recommend setting both, http and https, since most connections to repos are established using https nowadays:
-Dhttp.proxyHost=yourProxyAdress
-Dhttp.proxyPort=yourPort
-Dhttp.proxyUser=yourUsername
-Dhttp.proxyPassword=yourPassword
-Dhttps.proxyHost=yourProxyAdress
-Dhttps.proxyPort=yourPort
-Dhttps.proxyUser=yourUsername
-Dhttps.proxyPassword=yourPassword
1. Build Tools
Setting the proxy under "Build, Execution, Deployment" > "Build Tools" > "SBT" > "VM parameters" affects the SBT process that is executed after editing the build.sbt file and refreshing the latter. Also, this is used for indexing (and therefore auto completion). This setting will also affect the download of SBT itself in the version you selected during project setup.
2. Other Settings
Aditionally, I used the setting under "Other Settings" > "SBT" > "VM parameters"
3. Setting the proxy globally
Another way would be to set the proxy settings globally with your JAVA_OPTS as described here.
Add parameter VM
-Dhttps.proxyHost=hostName
-Dhttps.proxyPort=portUse
-Dhttps.proxyUser=proxyName
-Dhttps.proxyPassword=proxyPaword
It work for me
In my situation I have tried all above solutions, but they did not work.
In the end I have configured HTTP proxy for the whole IntellJ, and that have resolved my issues.
Settings > Appearance & Behaviour > System Settings > Http Proxy
If you are running a sbt-based scala project you may need to add the proxy in the run configuration of the project:
Run -> Edit configurations...->->VM parameters
I was seeing this same error message and tried all the suggestions mentioned in multiple (related) threads. I was able to finally resolve the problem by setting up the HTTP Proxy directly in IntelliJ. Here's what my settings look like (Note: specify your network username and password in the corresponding boxes):-
It seemed that in my case, something was picking up the environment variables http_proxy and https_proxy. Correctly setting (or in my case, unsetting, as I did not wish to use a proxy) these variables solved the proxy errors I was getting.