{"id":1676,"date":"2014-12-18T14:17:01","date_gmt":"2014-12-18T14:17:01","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1676"},"modified":"2014-12-18T14:17:01","modified_gmt":"2014-12-18T14:17:01","slug":"logging-couchbase-java-client","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/logging-couchbase-java-client\/","title":{"rendered":"Registro con el cliente Java de Couchbase"},"content":{"rendered":"<p><em style=\"line-height: 23px; font-family: ff-meta-serif-web-pro-1, ff-meta-serif-web-pro-2, Georgia, 'Times New Roman', Times, serif;\">[This blog was syndicated from https:\/\/nitschinger.at\/]<\/em><\/p>\n<h2>Introducci\u00f3n<\/h2>\n<p>Hay una gran variedad de marcos de registro para Java, y es dif\u00edcil complacer a todos. Para entender c\u00f3mo se gestiona actualmente el registro en el SDK, tenemos que retroceder unos a\u00f1os. Como ya sabr\u00e1s, el SDK depende del framework <a href=\"https:\/\/code.google.com\/p\/spymemcached\/\">spymemcached<\/a>\u00a0y, por tanto, hereda tambi\u00e9n sus mecanismos de registro. En los tiempos en que <a href=\"https:\/\/twitter.com\/dlsspy\">@dustin<\/a>\u00a0escribi\u00f3 esp\u00eda, no hab\u00eda una buena abstracci\u00f3n para el registro disponible (como <a href=\"https:\/\/www.slf4j.org\/\">SLF4J<\/a>), as\u00ed que escribi\u00f3 el suyo propio. Hoy en d\u00eda las cosas han cambiado, pero el espionaje sigue heredando este legado.<\/p>\n<p>En el momento de escribir esto, el SDK soporta el registro en un simple registrador por defecto (registra en STDERR a partir del nivel INFO), <a href=\"https:\/\/logging.apache.org\/log4j\/1.2\/\">Log4J<\/a>\u00a0y SunLogger (java.util.logging). En la pr\u00f3xima versi\u00f3n 2.9.0 de spymemcached, tambi\u00e9n ser\u00e1 compatible con la fachada de registro SLF4J donde podr\u00e1 conectar su propia implementaci\u00f3n. La pr\u00f3xima versi\u00f3n del SDK (probablemente 1.1.7) depender\u00e1 de spy 2.9, por lo que tambi\u00e9n obtendr\u00e1 los beneficios all\u00ed.<\/p>\n<p>Antes de profundizar en los conceptos, he aqu\u00ed los niveles de registro admitidos (definidos por <em>net.spy.memcached.compat.log.Level<\/em>):<\/p>\n<ol class=\"rteindent1\">\n<li>TRACE (con 2.9)<\/li>\n<li>DEBUG<\/li>\n<li>INFO<\/li>\n<li>AVISO<\/li>\n<li>ERROR<\/li>\n<li>FATAL<\/li>\n<\/ol>\n<p>Tenga en cuenta que los diferentes registradores implementan diferentes niveles, por lo que para algunos de ellos es necesario realizar un mapeo. Esto se indicar\u00e1 durante las descripciones de cada implementaci\u00f3n.<\/p>\n<p>A continuaci\u00f3n veremos los distintos mecanismos de registro disponibles y c\u00f3mo configurarlos. SLF4J ser\u00e1 cubierto hacia el final.<\/p>\n<h2>Conmutaci\u00f3n Registro<\/h2>\n<p>Si no cambias nada, se utilizar\u00e1 el logger por defecto. Este mecanismo s\u00f3lo imprime mensajes de registro en STDERR (a partir del nivel INFO). Lo m\u00e1s probable es que quiera integrar el SDK con la misma librer\u00eda de logging que utiliza. El LoggerFactory dentro de spy decide en la construcci\u00f3n cual elegir, basado en una propiedad del sistema. Por lo tanto, puede cambiar esto mediante programaci\u00f3n o a trav\u00e9s de un par\u00e1metro de la directiva <em>java<\/em> mando.<\/p>\n<p>Si desea utilizar el Log4JLogger mediante programaci\u00f3n, h\u00e1galo de esta forma (antes de inicializar el archivo <em>CouchbaseClient<\/em>\u00a0objeto):<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">Propiedades systemProperties = System.getProperties();<br \/>systemProperties.put(\"net.spy.log.LoggerImpl\", \"net.spy.memcached.compat.log.Log4JLogger\");<br \/>System.setProperties(systemProperties);<\/div>\n<\/div>\n<p><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">Por supuesto, necesitas a\u00f1adir el JAR Log4J a tu CLASSPATH para que funcione (como veremos m\u00e1s adelante). Alternativamente, puedes configurarlo as\u00ed en la l\u00ednea de comandos:<\/span><\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">java -Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.Log4JLogger ...<\/div>\n<\/div>\n<p>Ahora que ya sabemos c\u00f3mo activar las distintas implementaciones, vamos a verlas con m\u00e1s detalle.<\/p>\n<h2>El registrador simple por defecto<\/h2>\n<p><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">Si no cambia nada, el SDK utilizar\u00e1 el DefaultLogger (<\/span><em style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">net.spy.memcached.compat.log.DefaultLogger<\/em><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">). Este registrador no tiene dependencias e imprime todos los mensajes de registro de nivel INFO o superior (INFO, WARN, ERROR y FATAL) en el STDERR del sistema. Dado que el STDERR es cubierto por la mayor\u00eda de los IDEs autom\u00e1ticamente, tambi\u00e9n los ver\u00e1s en la ventana de salida de la consola.<\/span><\/p>\n<p>Como es tan simple, no se puede personalizar este comportamiento. Cada mensaje de registro recibe tambi\u00e9n un sello de tiempo (el formato es <em>aaaa-MM-dd HH:mm:ss.SSS<\/em>). Conectarse a Couchbase com\u00fanmente se parece a esto:<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">2013-05-07 12:28:41.852 INFO com.couchbase.client.CouchbaseConnection:  Added {QA sa=\/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue<br \/>2013-05-07 12:28:41.862 INFO com.couchbase.client.CouchbaseConnection:  Estado de conexi\u00f3n cambiado para sun.nio.ch.SelectionKeyImpl@3d9360e2<br \/>2013-05-07 12:28:41.887 INFO com.couchbase.client.ViewConnection:  A\u00f1adido localhost a la cola de conexi\u00f3n<br \/>2013-05-07 12:28:41.888 INFO com.couchbase.client.CouchbaseClient: la propiedad viewmode no est\u00e1 definida. Estableciendo viewmode a modo de producci\u00f3n.<br \/>2013-05-07 12:28:41.986 INFO com.couchbase.client.CouchbaseConnection:  Shut down Couchbase client<br \/>2013-05-07 12:28:41.991 INFO com.couchbase.client.ViewConnection:  El nodo localhost no tiene operaciones en la cola<br \/>2013-05-07 12:28:41.992 INFO com.couchbase.client.ViewNode:  Reactor de E\/S terminado para localhost<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>As\u00ed que el formato es siempre: <em><timestamp> <level> <classname> <message><\/em>. Recuerda que los mensajes DEBUG o similares no se registrar\u00e1n, por lo que no los ver\u00e1s con el DefaultLogger.<\/p>\n<div>\u00a0<\/div>\n<h2>SunLogger (java.util.logging)<\/h2>\n<p>El SunLogger tampoco introduce dependencias adicionales, ya que depende del m\u00f3dulo <em>java.util.logging<\/em> aplicaci\u00f3n. El sitio <em>java.util.logging.Level<\/em> define los siguientes niveles: ALL, CONFIG, FINEST, FINER, FINE, INFO, WARNING, SEVERE y OFF. Dado que esto no se corresponde bien con nuestros niveles definidos, a continuaci\u00f3n se muestra la correspondencia que se produce:<\/p>\n<div>\u00a0<\/div>\n<ol class=\"rteindent1\">\n<li>TRACE to FINEST (con 2.9)<\/li>\n<li><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">DEBUG a FINE<\/span><\/li>\n<li><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">INFO a INFO<\/span><\/li>\n<li><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">de WARN a WARNING<\/span><\/li>\n<li><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">ERROR a SEVERO<\/span><\/li>\n<li><span style=\"font-family: inherit; font-size: 1em; line-height: 1.4375em;\">FATAL a SEVERO<\/span><\/li>\n<\/ol>\n<div>\u00a0<\/div>\n<div>Sin m\u00e1s cambios, el SunLogger tambi\u00e9n imprime desde el nivel INFO hacia arriba de la siguiente manera:<\/div>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">7 de mayo de 2013 12:42:16 PM com.couchbase.client.CouchbaseProperties setPropertyFile<br \/>INFO: No se ha podido cargar el fichero de propiedades \"cbclient.properties\" porque: Archivo no encontrado con el cargador de clases del sistema.<br \/>May 7, 2013 12:42:16 PM net.spy.memcached.MemcachedConnection createConnections<br \/>INFO: A\u00f1adido {QA sa=\/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} a la cola de conexi\u00f3n.<br \/>7 de mayo de 2013 12:42:16 PM net.spy.memcached.MemcachedConnection handleIO<br \/>INFO: Estado de conexi\u00f3n cambiado para sun.nio.ch.SelectionKeyImpl@4ce2cb55<br \/>7 de mayo de 2013 12:42:16 PM com.couchbase.client.ViewConnection createConnections<br \/>INFO: A\u00f1adido localhost a la cola de conexi\u00f3n<br \/>7 de mayo de 2013 12:42:16 PM com.couchbase.client.CouchbaseClient <init><br \/>INFO: la propiedad viewmode no est\u00e1 definida. Establecer viewmode a modo de producci\u00f3n<br \/>May 7, 2013 12:42:16 PM com.couchbase.client.CouchbaseConnection run<br \/>INFO: Cerrar cliente Couchbase<br \/>7 de mayo de 2013 12:42:16 PM cierre de com.couchbase.client.ViewConnection<br \/>INFO: El nodo localhost no tiene operaciones en la cola.<br \/>May 7, 2013 12:42:16 PM com.couchbase.client.ViewNode$1 run<br \/>INFO: Reactor de E\/S terminado para localhost<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Si quieres cambiar el nivel de registro a DEBUG e inferior, puedes hacerlo as\u00ed:<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">Logger.getLogger(\"com.couchbase.client\").setLevel(Level.FINEST);<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Now there is one more thing you need to do if you want to print all debug messages to the console. You set the logging level correctly, but the `ConsoleHandler` is not set to debug yet (so most likely you will pay the price for debug logging, but won&#39;t actually see anything in your IDE).<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">for(Handler h : Logger.getLogger(\"com.couchbase.client\").getParent().getHandlers()) {<br \/>\u00a0 \u00a0 \u00a0if(h instanceof ConsoleHandler) {<br \/>\u00a0 \u00a0 \u00a0 \u00a0 h.setLevel(Level.FINEST);<br \/>\u00a0 \u00a0 \u00a0}<br \/>}<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>So, here is a full example on how to use the `SunLogger` and get all Debug messages on the console.<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">\u00a0 \u00a0 Propiedades systemProperties = System.getProperties();<br \/>\u00a0 \u00a0 systemProperties.put(\"net.spy.log.LoggerImpl\", \"net.spy.memcached.compat.log.SunLogger\");<br \/>\u00a0 \u00a0 System.setProperties(systemProperties);<\/p>\n<p>\u00a0 \u00a0 Logger logger = Logger.getLogger(\"com.couchbase.client\");<br \/>\u00a0 \u00a0 logger.setLevel(Level.FINEST);<br \/>\u00a0 \u00a0 for(Handler h : logger.getParent().getHandlers()) {<br \/>\u00a0 \u00a0 \u00a0 \u00a0if(h instanceof ConsoleHandler){<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0h.setLevel(Level.FINEST);<br \/>\u00a0 \u00a0 \u00a0 \u00a0}<br \/>\u00a0 \u00a0 }<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Then just go ahead and create your `CouchbaseClient` object, you will see detailed output like this (trimmed here):<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">May 7, 2013 12:54:34 PM com.couchbase.client.vbucket.ReconfigurableObserver update<br \/>FINEST: Recibida una actualizaci\u00f3n, notificando reconfigurables sobre un com.couchbase.client.vbucket.config.Bucketcom.couchbase.client.vbucket.config.Bucket@3d77949<br \/>May 7, 2013 12:54:34 PM com.couchbase.client.vbucket.ReconfigurableObserver update<br \/>FINEST: Recibida una actualizaci\u00f3n, notificando reconfigurables sobre un com.couchbase.client.vbucket.config.Bucketcom.couchbase.client.vbucket.config.Bucket@4e927ae<br \/>May 7, 2013 12:54:34 PM com.couchbase.client.vbucket.ReconfigurableObserver update<br \/>FINEST: Dice que es por defecto y est\u00e1 hablando con \/pools\/default\/bucketsStreaming\/default?bucket_uuid=adfff22b70e09fafaa26ca37b7e05e9d<br \/>May 7, 2013 12:54:34 PM com.couchbase.client.vbucket.ReconfigurableObserver updat<br \/>FINEST: Dice que es por defecto y est\u00e1 hablando con \/pools\/default\/bucketsStreaming\/default?bucket_uuid=adfff22b70e09fafaa26ca37b7e05e9d<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<h2>Log4J<\/h2>\n<p>La mayor\u00eda de la gente necesitar\u00e1 m\u00e1s flexibilidad, y Log4J era (y sigue siendo) est\u00e1ndar en muchas aplicaciones. El SDK tambi\u00e9n proporciona soporte para Log4J. Para que funcione, primero tienes que configurar la instancia correctamente:<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">\u00a0 \u00a0 Propiedades systemProperties = System.getProperties();<br \/>\u00a0 \u00a0 systemProperties.put(\"net.spy.log.LoggerImpl\", \"net.spy.memcached.compat.log.Log4JLogger\");<br \/>\u00a0 \u00a0 System.setProperties(systemProperties);<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Now if you run this, you&#39;ll get an error that some of the Log4J classes can not be found. This is not a surprise, because its not on the classpath. Let&#39;s fix this by adding it accordingly. If you use maven, add the `log4j.log4j` dependency (current version is 1.2.17). You can also just download the JAR and add it to the CLASSPATH as needed.<\/p>\n<div>\u00a0<\/div>\n<div>Ahora, si lo ejecutamos de nuevo, obtenemos otro error:<\/div>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">log4j:WARN No se han encontrado appenders para el logger (com.couchbase.client.vbucket.ConfigurationProviderHTTP).<br \/>log4j:WARN Por favor, inicialice el sistema log4j correctamente.<br \/>log4j:WARN Consulte https:\/\/logging.apache.org\/log4j\/1.2\/faq.html#noconfig para obtener m\u00e1s informaci\u00f3n.<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Una forma de solucionarlo es obtener un <em>log4j.xml<\/em>\u00a0en nuestro CLASSPATH, pero para que funcione con rapidez Log4J proporciona un archivo de configuraci\u00f3n <em>ConfiguradorB\u00e1sico<\/em>. Justo despu\u00e9s de las configuraciones de las propiedades del sistema, a\u00f1ade esto:<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">org.apache.log4j.BasicConfigurator.configure();<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Si lo ejecutas con el cambio de c\u00f3digo aplicado, ver\u00e1s que obtenemos mensajes de registro bien impresos. Tambi\u00e9n puede ver que se muestran directamente desde el nivel DEBUG (e incluso contienen informaci\u00f3n de qu\u00e9 hilo se registraron):<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">69 [main] INFO com.couchbase.client.CouchbaseConnection - A\u00f1adido {QA sa=\/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} a la cola de conexi\u00f3n.<br \/>70 [main] DEBUG com.couchbase.client.vbucket.VBucketNodeLocator - Actualizando nodesMap en VBucketNodeLocator.<br \/>73 [main] DEBUG com.couchbase.client.vbucket.VBucketNodeLocator - A\u00f1adiendo nodo con nombre de host 127.0.0.1:11210.<br \/>74 [main] DEBUG com.couchbase.client.vbucket.VBucketNodeLocator - El nodo a\u00f1adido es {QA sa=localhost\/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=8}.<br \/>74 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] DEBUG com.couchbase.client.CouchbaseConnection - Terminado el tratamiento de la cola.<br \/>74 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] DEBUG com.couchbase.client.CouchbaseConnection - Seleccionando con retardo de 0ms<br \/>79 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] DEBUG com.couchbase.client.CouchbaseConnection - Seleccionado 1, seleccionadas 1 claves<br \/>79 [Memcached IO sobre<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Puedes controlar los niveles de registro a trav\u00e9s de los mecanismos habituales de Log4J. No voy a entrar en detalles acerca de ellos aqu\u00ed, as\u00ed que por favor <a href=\"https:\/\/logging.apache.org\/log4j\/1.2\/manual.html\">comprobar<\/a>\u00a0su documentaci\u00f3n oficial (por ejemplo, sobre c\u00f3mo utilizar el <em>Configurador de propiedades<\/em> en su lugar).<\/p>\n<p>Hablando de Log4J, \u00a0<a href=\"https:\/\/twitter.com\/zooldk\">Steffen Larsen<\/a>\u00a0implementado un <a href=\"https:\/\/github.com\/zooldk\/log4j-couchbase\">Ap\u00e9ndice Log4J<\/a>\u00a0\u00a1para almacenar los registros en Couchbase (en lugar de un archivo)!<\/p>\n<h2>La nueva fachada: SLF4J<\/h2>\n<p>No vincular la aplicaci\u00f3n a una biblioteca de registro espec\u00edfica es siempre una buena idea. SLF4J es una fachada para varios marcos de registro enchufables detr\u00e1s de \u00e9l. As\u00ed que puedes elegir la implementaci\u00f3n de registro durante el tiempo de ejecuci\u00f3n, ya sea <a href=\"https:\/\/logback.qos.ch\/\">Logback<\/a>Log4J u otros. Puesto que ya hemos probado Log4J, vamos a hacer que SLF4J funcione con Logback, uno de los marcos de registro m\u00e1s comunes que existen.<\/p>\n<p>Tenga en cuenta que la compatibilidad con SLF4J estar\u00e1 disponible en la versi\u00f3n 1.9.0 de spymemcached y, por tanto, tambi\u00e9n en una de las pr\u00f3ximas versiones del SDK Java de Couchbase.<\/p>\n<p>En primer lugar, tenemos que configurarlo en consecuencia:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">Propiedades systemProperties = System.getProperties();<br \/>systemProperties.put(\"net.spy.log.LoggerImpl\", \"net.spy.memcached.compat.log.SLF4JLogger\");<br \/>System.setProperties(systemProperties);<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Now, we need to include two JARs into our classpath. The first one is the SLF4J facade API and the other one is our logging framework of choice. The facade API package is called `slf4j-api` (this package always needs to be in place) and since we want to use logback we need to include the `logback-classic` JAR. Note that this is not specific to the SDK, you can find this information <a href=\"https:\/\/logback.qos.ch\/manual\/introduction.html\">aqu\u00ed<\/a>. Si usas maven, puedes usar este snippet:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">\u00a0 \u00a0 <dependency><br \/>\u00a0 \u00a0 \u00a0 <groupid>org.slf4j<\/groupid><br \/>\u00a0 \u00a0 \u00a0 <artifactid>slf4j-api<\/artifactid><br \/>\u00a0 \u00a0 \u00a0 <version>1.7.5<\/version><br \/>\u00a0 \u00a0 <\/dependency><br \/>\u00a0 \u00a0 <dependency><br \/>\u00a0 \u00a0 \u00a0 <groupid>ch.qos.logback<\/groupid><br \/>\u00a0 \u00a0 \u00a0 <artifactid>logback-classic<\/artifactid><br \/>\u00a0 \u00a0 \u00a0 <version>1.0.12<\/version><br \/>\u00a0 \u00a0 <\/dependency><\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>SLF4J recoger\u00e1 autom\u00e1ticamente nuestra implementaci\u00f3n de logback, por lo que los registros tendr\u00e1n este aspecto:<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">13:25:43.692 [main] INFO c.c.client.CouchbaseConnection - A\u00f1adido {QA sa=\/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} a la cola de conexi\u00f3n.<br \/>13:25:43.694 [main] DEBUG c.c.c.vbucket.VBucketNodeLocator - Actualizando nodesMap en VBucketNodeLocator.<br \/>13:25:43.697 [main] DEBUG c.c.c.vbucket.VBucketNodeLocator - A\u00f1adiendo nodo con nombre de host 127.0.0.1:11210.<br \/>13:25:43.697 [main] DEBUG c.c.c.vbucket.VBucketNodeLocator - El nodo a\u00f1adido es {QA sa=localhost\/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=8}.<br \/>13:25:43.698 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] DEBUG c.c.client.CouchbaseConnection - Terminado el tratamiento de la cola.<br \/>13:25:43.699 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] DEBUG c.c.client.CouchbaseConnection - Seleccionando con retardo de 0ms<br \/>13:25:43.702 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] DEBUG c.c.client.CouchbaseConnection - Seleccionado 1, seleccionadas 1 claves<br \/>13:25:43.703 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] DEBUG c.c.client.CouchbaseConnection - Manejo de IO para: sun.nio.ch.SelectionKeyImpl@48ff2413 (r=false, w=false, c=true, op={QA sa=localhost\/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=8})<br \/>13:25:43.703 [Memcached IO sobre {MemcachedConnection a localhost\/127.0.0.1:11210}] INFO c.c.client.CouchbaseConnection - Estado de conexi\u00f3n cambiado para sun.nio.ch.SelectionKeyImpl@48ff2413<br \/>13:25:43.713<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<p>Como puedes ver, aqu\u00ed tambi\u00e9n incluyen el registro a nivel DEBUG. Si no incluye la implementaci\u00f3n de registro durante el tiempo de ejecuci\u00f3n, SLF4J se quejar\u00e1 al inicio:<\/p>\n<div>\u00a0<\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family:monospace;\">SLF4J: Error al cargar la clase \"org.slf4j.impl.StaticLoggerBinder\".<br \/>SLF4J: Implementaci\u00f3n por defecto del registrador sin operaci\u00f3n (NOP)<br \/>SLF4J: Para m\u00e1s informaci\u00f3n, consulte https:\/\/www.slf4j.org\/codes.html#StaticLoggerBinder<\/div>\n<\/div>\n<div>\u00a0<\/div>\n<div>Si quieres aprender a configurar logback, <a href=\"https:\/\/logback.qos.ch\/manual\/configuration.html\">mira aqu\u00ed<\/a>.<\/div>\n<div>\u00a0<\/div>\n<h2>Resumen<\/h2>\n<p>Una vez que conoces la abstracci\u00f3n en spymemcached y c\u00f3mo funciona, cambiar de implementaci\u00f3n de logging es f\u00e1cil y directo. Si trabajas con alguna de las personas de Couchbase para reportar errores, por favor intenta incluir la salida con DEBUG activado, porque esto incluye mucha informaci\u00f3n \u00fatil que puede ser usada para determinar las fuentes de fallo.<\/p>\n<p>Con la fachada SLF4J que se a\u00f1adir\u00e1 en la pr\u00f3xima versi\u00f3n esp\u00eda (2.9), podr\u00e1 conectar al SDK todos los grandes marcos de registro existentes. H\u00e1ganos saber si usted ve un caso de uso no cubierto con estos mecanismos o si tiene otros comentarios sobre esto.<\/p>","protected":false},"excerpt":{"rendered":"<p>[This blog was syndicated from https:\/\/nitschinger.at\/] Introduction There is a huge variety in logging frameworks for Java, and its hard to please everyone. To understand how logging is currently handled in the SDK, we have to go back a few [&hellip;]<\/p>","protected":false},"author":19,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[1281],"ppma_author":[8987],"class_list":["post-1676","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-logging"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Logging with the Couchbase Java Client - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/es\/logging-couchbase-java-client\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Logging with the Couchbase Java Client\" \/>\n<meta property=\"og:description\" content=\"[This blog was syndicated from https:\/\/nitschinger.at\/] Introduction There is a huge variety in logging frameworks for Java, and its hard to please everyone. To understand how logging is currently handled in the SDK, we have to go back a few [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/logging-couchbase-java-client\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-18T14:17:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Michael Nitschinger\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@daschl\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Nitschinger\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/\"},\"author\":{\"name\":\"Michael Nitschinger\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d\"},\"headline\":\"Logging with the Couchbase Java Client\",\"datePublished\":\"2014-12-18T14:17:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/\"},\"wordCount\":2201,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"Logging\"],\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/\",\"name\":\"Logging with the Couchbase Java Client - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2014-12-18T14:17:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Logging with the Couchbase Java Client\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d\",\"name\":\"Michael Nitschinger\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/95e178617974d46e3b02dd1754a3f60b\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g\",\"caption\":\"Michael Nitschinger\"},\"description\":\"Michael Nitschinger works as a Principal Software Engineer at Couchbase. He is the architect and maintainer of the Couchbase Java SDK, one of the first completely reactive database drivers on the JVM. He also authored and maintains the Couchbase Spark Connector. Michael is active in the open source community, a contributor to various other projects like RxJava and Netty.\",\"sameAs\":[\"https:\/\/nitschinger.at\",\"https:\/\/x.com\/daschl\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/michael-nitschinger\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Logging with the Couchbase Java Client - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/es\/logging-couchbase-java-client\/","og_locale":"es_MX","og_type":"article","og_title":"Logging with the Couchbase Java Client","og_description":"[This blog was syndicated from https:\/\/nitschinger.at\/] Introduction There is a huge variety in logging frameworks for Java, and its hard to please everyone. To understand how logging is currently handled in the SDK, we have to go back a few [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/es\/logging-couchbase-java-client\/","og_site_name":"The Couchbase Blog","article_published_time":"2014-12-18T14:17:01+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Michael Nitschinger","twitter_card":"summary_large_image","twitter_creator":"@daschl","twitter_misc":{"Written by":"Michael Nitschinger","Est. reading time":"11 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/"},"author":{"name":"Michael Nitschinger","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d"},"headline":"Logging with the Couchbase Java Client","datePublished":"2014-12-18T14:17:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/"},"wordCount":2201,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["Logging"],"articleSection":["Uncategorized"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/","url":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/","name":"Logging with the Couchbase Java Client - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2014-12-18T14:17:01+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/logging-couchbase-java-client\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Logging with the Couchbase Java Client"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d","name":"Michael Nitschinger","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/95e178617974d46e3b02dd1754a3f60b","url":"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g","caption":"Michael Nitschinger"},"description":"Michael Nitschinger trabaja como Ingeniero de Software Principal en Couchbase. Es el arquitecto y mantenedor del SDK Java de Couchbase, uno de los primeros controladores de bases de datos completamente reactivos en la JVM. Tambi\u00e9n es autor y mantiene el conector Spark de Couchbase. Michael participa activamente en la comunidad de c\u00f3digo abierto, contribuyendo a otros proyectos como RxJava y Netty.","sameAs":["https:\/\/nitschinger.at","https:\/\/x.com\/daschl"],"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/michael-nitschinger\/"}]}},"authors":[{"term_id":8987,"user_id":19,"is_guest":0,"slug":"michael-nitschinger","display_name":"Michael Nitschinger","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g","author_category":"","last_name":"Nitschinger, Principal Software Engineer, Couchbase","first_name":"Michael","job_title":"","user_url":"https:\/\/nitschinger.at","description":"Michael Nitschinger trabaja como Ingeniero de Software Principal en Couchbase. Es el arquitecto y mantenedor del SDK Java de Couchbase, uno de los primeros controladores de bases de datos completamente reactivos en la JVM. Tambi\u00e9n es autor y mantiene el conector Spark de Couchbase. Michael participa activamente en la comunidad de c\u00f3digo abierto, contribuyendo a otros proyectos como RxJava y Netty."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/1676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=1676"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/1676\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=1676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=1676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=1676"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=1676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}