Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2357109A5 for ; Mon, 3 Feb 2014 13:53:16 +0000 (UTC) Received: (qmail 75079 invoked by uid 500); 3 Feb 2014 13:53:15 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 74630 invoked by uid 500); 3 Feb 2014 13:53:09 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 74619 invoked by uid 99); 3 Feb 2014 13:53:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Feb 2014 13:53:07 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [216.109.115.99] (HELO nm19-vm4.access.bullet.mail.bf1.yahoo.com) (216.109.115.99) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Feb 2014 13:53:00 +0000 Received: from [66.196.81.159] by nm19.access.bullet.mail.bf1.yahoo.com with NNFMP; 03 Feb 2014 13:52:39 -0000 Received: from [66.196.81.132] by tm5.access.bullet.mail.bf1.yahoo.com with NNFMP; 03 Feb 2014 13:52:39 -0000 Received: from [127.0.0.1] by omp1008.access.mail.bf1.yahoo.com with NNFMP; 03 Feb 2014 13:52:39 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 490466.37170.bm@omp1008.access.mail.bf1.yahoo.com Received: (qmail 34032 invoked by uid 60001); 3 Feb 2014 13:52:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s1024; t=1391435558; bh=5BCMiUbh5ZkOpWONhwtvExKkh74j8mcR3KRwG3XQBXE=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=R6VDhJyEiZi7w8i1aPOp7R9ITbx4ZNZy8MUvQSzZdATdKY+tLCUc4htatnwjoazQYii83N3ByJ7+Q28vK1s25+7s7CjNo4a9RNm3POwljCrhNyKJpvgjzia5i8Y+dNtHNwKshvDyn7vqLKjnLjNkEMiX8uWPRTurpp8AtbvVQpc= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=1goiV9gMB0VCVeIy4xTgTWDzC4eQJfi1Hd/PJ3Q4egPXARsagUHvKmCE23O2m7hPY713MFPg19PZlWWLJJ5PV0wnareaPt/vJGum113EP7G++evV+7MXODvWRoR1ApvxP41sUozjhejUwiQtFbT2OVh9slxc7LbKCkWc/ofYbfg=; X-YMail-OSG: xDuO3sEVM1kzxFvfs40qAoUXnyJ0ISvlgjK6ZjfAMzLBIaH 6_9yErpHWlad5mq2Y_Quj_84x0njiG074dsMp5f5n3tXL6iCKQun9e6dE3Xb BliFcEX4_onDgA7p0VvtdcenfV0f1URLZi.i.xm2Ve70PbuoWzGcJb6eeZW7 NIj8wkQymBWqG5R2NdN_QguSmu3znH9XqoA8Y0NLRRdOn9gsKwetIGQwKvMs U9iEzHTKqQvL18iyTs_x4XGlEQwShCovIJmes7DWlnON0S0sLJEUc7fznG4f cJZQHgCoyQkDdOqp3opa6A9FH0.ngzggaDOw8Ia.pRr6XcjbFN565kJCV52E Z6H2wXtwBGzwpkKFQ3_Gyg7Dg9vCr0HhJ0r7Ngml9DOEIusj5oMSlpwB.7bE Yk70aIi1N8Cks0Mq_3d0Nq_H7iISYfrTF7v2a..keD9D6BKfkBXXsFZgTT1u NQ8bGN4xJx.tQsEkxoDmKdF2yR2i_pp6d5MJI1Nw8NxYiaDcaTDOX.EQMynY aYkGUtdCYUv4CFLaJMo7CkkHi6ZukTsLuB2FSkUZjPoj3Fpb0gloyI7AySp_ OvJ3qQwyiu4ebpEBJuGpneCDWs7HPUi6HrNKZ4pDNKzl3EjLHS1sFFSZr1D4 KgHNzq.jHSDVwb1a911znnQcIUdH4Lw-- Received: from [99.189.12.49] by web181705.mail.ne1.yahoo.com via HTTP; Mon, 03 Feb 2014 05:52:38 PST X-Rocket-MIMEInfo: 002.001,WWVzLCBpdCB3YXMgYnVmZmVyaW5nLiBUaGF0IGdvdCBtZSBjbG9zZXIuwqAgVGhhbmtzLsKgIAoKTm93IEkgZ2V0IGFuICdJbnZhbGlkIExvZyBNZXNzYWdlJyB3aGVuIEkgdHJ5IHRvIGxvZy7CoCBNeSBsb2cgbWVzc2FnZSBpcyBleGFjdGx5OgpbImxvZyIseyJsb2ciIDogIlRoZSBwcm9jZXNzIHN0YXJ0ZWQifV0KCsKgwqDCoCAoIHdoaWNoIEkgY29kZWQgYXMgc3RyY3B5KGJ1ZmZlciwiW1wibG9nXCIse1wibG9nXCIgOiBcIlRoZSBwcm9jZXNzIHN0YXJ0ZWRcIn1dXG4iKTvCoCApCgpCZWNhdXNlIHRoZSABMAEBAQE- X-Mailer: YahooMailWebService/0.8.174.629 References: <1391319607.37651.YahooMailNeo@web181704.mail.ne1.yahoo.com> Message-ID: <1391435558.31009.YahooMailNeo@web181705.mail.ne1.yahoo.com> Date: Mon, 3 Feb 2014 05:52:38 -0800 (PST) From: Scott Weber Reply-To: Scott Weber Subject: Re: Cannot get os_daemon api to function To: "user@couchdb.apache.org" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-237291172-1097780724-1391435558=:31009" X-Virus-Checked: Checked by ClamAV on apache.org ---237291172-1097780724-1391435558=:31009 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Yes, it was buffering. That got me closer.=C2=A0 Thanks.=C2=A0 =0A=0ANow I = get an 'Invalid Log Message' when I try to log.=C2=A0 My log message is exa= ctly:=0A["log",{"log" : "The process started"}]=0A=0A=C2=A0=C2=A0=C2=A0 ( w= hich I coded as strcpy(buffer,"[\"log\",{\"log\" : \"The process started\"}= ]\n");=C2=A0 )=0A=0ABecause the doc says the message must be a JSON.=C2=A0 = As shown below:=0A---------------------------------------------------------= -------=0A=0A7.3.2. Logging API=0AThere=E2=80=99s also an API for adding me= ssages to CouchDB=E2=80=99s logs. Its simply:=0A["log", $MESG]\n=0AWhere $M= ESG is any arbitrary JSON. There is no response from this command. As=0Awit= h the config API, the trailing \n represents a newline byte.---------------= --------------------------------------------------=0AThe error that is repo= rted is:=0A=0A-------------------------------------------------------------= =0A[info] [<0.36.0>] Apache CouchDB has started on http://0.0.0.0:5984/=0A[= error] [<0.139.0>] Invalid log message from daemon "my_test": {[{<<"log">>,= =0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 <<"The process started">>}]}=0A-------------------------= ------------------------------------=0A=0A=0AAny idea what it is really exp= ecting?=0A=0A-Scott=0A=0A=0A=0A________________________________=0A From: Pa= ul Davis =0ATo: "user@couchdb.apache.org" ; Scott Weber =0ASent: Mond= ay, February 3, 2014 12:21 AM=0ASubject: Re: Cannot get os_daemon api to fu= nction=0A =0A=0AI reckon your stdout is buffered. Try adding an fflush call= after the=0Asecond fputs.=0A=0AOn Sat, Feb 1, 2014 at 11:40 PM, Scott Webe= r wrote:=0A> I am using version 1.5.=C2=A0 I can= get the daemon to start, but there does not appear to be any communication= on stdin/stdout.=0A>=0A> Below are my settings, and a simple C example. I = would expect this simple code to log a message, then give me a reply of the= config settings. However nothing happens.=0A>=0A> Couch does restart the d= aemon if I change a config setting under [os_daemons].=C2=A0 And the settin= gs do appear in the config page of Futon.=0A>=0A> The example program does = also exit when Couch closes the stdin connection, as expected.=0A>=0A>=0A> = Any advice is appreciated.=0A>=0A> -Scott=0A>=0A>=0A> CONFIG SETTINGS:=0A> = [log]=0A> level =3D info=0A>=0A> [os_daemons]=0A>=0A> my_test =3D c:/path/n= ativeDaemon/debug/NativeDaemon.exe=0A>=0A> [my_test]=0A> Value =3D 10,002= =0A> OtherValue =3D The other value=0A>=0A>=0A>=0A> Actual C code=C2=A0 (us= es Windows Sleep, otherwise is agnostic) :=0A>=0A>=0A> int main() {=0A>=C2= =A0 =C2=A0 char buffer[257];=0A>=0A>=C2=A0 =C2=A0 LogMessage("\nSTART:", = "Daemon Startup");=C2=A0 //=C2=A0 My own log file to disk=0A>=C2=A0 =C2=A0 = Sleep(3000);=0A>=0A>=C2=A0 =C2=A0 fputs("[\"log\",{\"log\" : \"The proces= s started\"}]\n",stdout);=0A>=C2=A0 =C2=A0 fputs("[\"get\", \"os_daemons\"= ]\n",stdout);=0A>=0A>=C2=A0 =C2=A0 do {=0A>=C2=A0 =C2=A0 =C2=A0 =C2=A0 fg= ets(buffer,256,stdin);=0A>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (feof(stdin)) {= =0A>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LogMessage("\nCLOSE:","Close= d STDIN"); //=C2=A0 This does exit when expected=0A>=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 break;=0A>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }=0A>=0A>=0A> = // etc... into loop. ---237291172-1097780724-1391435558=:31009--