dependencies
section of build.gradle
mentioned on that page.)--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/Mh7nIHru1Zk/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I am wondering how you running vertx with installation...
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Hi Tim,
We don't use container.log() actually. Instead we're doing it like this:
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
� � ...� � private static final Logger logger = LoggerFactory.getLogger(SomeClass.class);
� � ...� � // this code is run by a Verticle� ��logger.info("Something happened today again, look: {}", something);
And as dependencies we've added Logback � in build.gradle:
dependencies {� � configurations {
� � � � ...� � � � compile group: 'ch.qos.logback', name : 'logback-classic', version : '1.0.13'� � � � compile group: 'org.slf4j', name : 'slf4j-api', version : '1.7.5'� � � � compile group: 'org.slf4j', name : 'jcl-over-slf4j', version : '1.7.5'� � � � compile group: 'org.slf4j', name : 'log4j-over-slf4j', version : '1.7.5'
So yes I think that means that we're doing our own logging, using the SLF4J API in our verticle code.
Best regards,KajMagnus
On Friday, December 13, 2013 2:57:07 PM UTC, Tim Fox wrote:
I'm a bit confused about what you're trying to do.. Are you trying to use logback for the built in container logging (i.e. what you use when you container.log()), or do you want to ignore that and just do your own logging using the logback API in your verticle code?
On 12/12/13 11:09, Kaj Magnus Lindberg wrote:
Hi,
We're having problems with Logback and Vert.x: apparently different instances of the Logback appender are created for each verticle, presumably beacus each verticle uses its own class loaders. This apparently results in problems with files being overwritten when the appenders roll over the files.
There might be a solution to that problem: �This Vert.x Goolge Groups email from december 2012 suggests that the logging framework JARs be loaded by the system classloader, so that only 1 instance of the log framework is create. (instead of one per vertex?).�Quotes:�� "...Put your logging JARs on the system classpath..."� �"...This provides log4j and slf4j on the system classpath, so there will only be a single instance of the logger..."
Questions:
- How do I place the logging JARs on the system classpath? How do we make Vert.x load the logging framework only once? (We're using Vert.x version 2.0.0-final, Gradle, and logback-classic-1.0.13.)
- Do you think we're on the right track? Does it seem reasonable that conflicts between [different rolling-file-appenders loaded by different classloaders] cause problems when log files are rolled over?
Extra info 1:When we've started Vert.x (`./gradlew runMod`), Vert.x does open the log file in many different file handles:
$ lsof log-file.log�COMMAND �PID � � �USER � FD � TYPE DEVICE SIZE/OFF � NODE NAMEjava � �4572 kajmagnus �206w � REG � �8,1 � �11626 396901 log-file.logjava � �4572 kajmagnus �210w � REG � �8,1 � �11626 396901 log-file.logjava � �4572 kajmagnus �212w � REG � �8,1 � �11626 396901 log-file.logjava � �4572 kajmagnus �215w � REG � �8,1 � �11626 396901 log-file.logjava � �4572 kajmagnus �222w � REG � �8,1 � �11626 396901 log-file.logjava � �4572 kajmagnus �224w � REG � �8,1 � �11626 396901 log-file.logjava � �4572 kajmagnus �226w � REG � �8,1 � �11626 396901 log-file.log
Extra info 2:When we configured Logback to use prudent mode (which avoids conflicts between different processes writing to the same log file), our problems were solved. However the prudent mode affects performance.
Best regards,KajMagnus
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
logback-classic-1.0.13.jar
logback-core-1.0.13.jar
slf4j-api-1.7.6.jar
java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
We downloaded no zip. Instead we cloned a Git repo, https://github.com/vert-x/vertx-gradle-template, which contains some Gradle config files, but no Vert.x installation and no Vert.x related JAR files at all actually. What happens is (I think) that Gradle fetches Vert.x JARs from some online repositories, and puts them in Gradle's local repository, and starts Vert.x via those JARs somehow.
Apparently there's no "real" Vert.x installation anywhere — when I searched for the "vertx-core" JAR file, I found it only in Gradle's local repository (which isn't a Vert.x installation but rather something like a Maven or Ivy repo):
~$ find . -name '*vertx-core*'./.gradle/caches/artifacts-23/module-metadata/io.vertx/vertx-core./.gradle/caches/artifacts-23/filestore/io.vertx/vertx-core./.gradle/caches/artifacts-23/filestore/io.vertx/vertx-core/2.0.0-final/source/f5bdac7f28b948ee762eb6bbf760fa233e9ec578/vertx-core-2.0.0-final-sources.jar./.gradle/caches/artifacts-23/filestore/io.vertx/vertx-core/2.0.0-final/jar/7b19f7e13bbb57cf3fd996008a11b56f1a5e9221/vertx-core-2.0.0-final.jar./.gradle/caches/artifacts-23/filestore/io.vertx/vertx-core/2.0.0-final/pom/497faa4b1868ab3da6c84e911821710598751991/vertx-core-2.0.0-final.pom./.gradle/caches/artifacts-24/module-metadata/io.vertx/vertx-core./.gradle/caches/artifacts-24/filestore/io.vertx/vertx-core./.gradle/caches/artifacts-24/filestore/io.vertx/vertx-core/2.0.0-final/source/f5bdac7f28b948ee762eb6bbf760fa233e9ec578/vertx-core-2.0.0-final-sources.jar./.gradle/caches/artifacts-24/filestore/io.vertx/vertx-core/2.0.0-final/jar/7b19f7e13bbb57cf3fd996008a11b56f1a5e9221/vertx-core-2.0.0-final.jar./.gradle/caches/artifacts-24/filestore/io.vertx/vertx-core/2.0.0-final/pom/497faa4b1868ab3da6c84e911821710598751991/vertx-core-2.0.0-final.pom./.IdeaIC12/system/jars/vertx-core-2.0.0-final-sources.jar.b1c0531d./.IdeaIC12/system/jars/vertx-core-2.0.0-final.jar.afc6d5e./.IdeaIC12/system/jars/vertx-core-2.0.0-final.jar.517fd79d./.IdeaIC12/system/jars/vertx-core-2.0.0-final-sources.jar.be8e5b7e
So, as far as I can tell, there's nowhere to place the Logback JARs (or at least I cannot figure out where).
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
I am not sure how this has worked.
The included modules classloader does not appear to be used to load classes by the individual verticals classloader. Looking at the code of ModuleClassLoader it only uses the included modules classloader to reference resources but not to load classes.
This means that when in a vertical you put `LoggerFactory.getLogger(FooVerticle.class)` the LoggerFactory is loaded by the verticals classloader and not the classloader of the included module, as are all its dependant classes, and logback reinitialises again as it cannot see the previously initialised static instances.
I cant see how this approach could work at the moment.
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/Mh7nIHru1Zk/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-- John Oliver
--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/Mh7nIHru1Zk/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-- John Oliver
It is on the platform classpath, but is logback? Logback needs to be available to the platform, not the module.
To unsubscribe from this group and all its topics, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.