Giter VIP home page Giter VIP logo

jlog's People

Contributors

brucespang avatar dunn avatar esproul avatar jpeach avatar markcreyn avatar noj avatar pamaddox avatar postwait avatar vikingsloth avatar wez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jlog's Issues

Makefile error

I used autoconf to generate the Makefile, but find some bugs in it:

install-python:
    cd python && make install

clean:
    rm -f *.o *.lo *.$(DOTSO) *.a jthreadtest jtest jlogctl jlogtail
    rm -f java/*.jar java/*.jnilib java/*.lo
    -if test -f perl/Makefile ; then cd perl ; make clean ; fi
    cd python && make clean

can we really run make command in the python folder?

How to build python module

Hello,

could anyone explain how can I build and use jlog in a python script?

$ python test_jlog.py
Traceback (most recent call last):
  File "test_jlog.py", line 8, in <module>
    from jlog import *
ImportError: No module named jlog

Build jlog to python package

I tried to use the setup.py file in /python folder to build jlog.

it throws error:

 #warning "16 bit int type not found."
  ^
jlog_config.h:125:2: error: #error "32 bit int type not found."
 #error "32 bit int type not found."
  ^
jlog_config.h:141:2: error: #error "8 bit int type not found."
 #error "8 bit int type not found."
  ^
jlog_config.h:149:2: warning: #warning "16 bit int type not found." [-Wcpp]
 #warning "16 bit int type not found."
  ^
jlog_config.h:158:2: error: #error "32 bit int type not found."
 #error "32 bit int type not found."
  ^
In file included from jlog.c:7008:0:
/usr/include/python2.7/longintrepr.h:43:2: error: #error "30-bit long digits requested, but the necessary types are not available on this platform"
 #error "30-bit long digits requested, but the necessary types are not available on this platform"
  ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

So as you see, I am running on 64 bit Linux, does it a platform issue ?
Thanks !
@postwait

New release to include the latest fix

There is a fix for an erroneous warning message that jlogctl was emitting that hasn't been released yet (commit 05acd3e). Since that was done in 2020, please, do you think we can get a new release that would include the bug fix? Thanks!

EINTR bug in 1.2 code

The function in jlog_file_size in jlog_io.c from jlog-1.2 has the following broken logic in it:

while ((rv = fstat(f->fd, &sb) != 0) == -1 && errno == EINTR) ;

Extracting this sub-expression:

(rv = fstat(f->fd, &sb) != 0) == -1

There are a couple of issues with this:

  1. != has higher precedence in C than assignment (=), so this effectively like writing:

rv = (fstat(f->fd, &sb) != 0) == -1

That is probably not the author's original intention.

  1. rv will end up containing a boolean value, which is compared with -1. That test will always
    evaluate to false, since 0 and 1 are not equal to -1.

The net result is that the EINTR (interrupted syscall) handling is broken in jlog 1.2.

JLOG_ERR_META_OPEN Error when running examples

Hey there!

I'm trying to get the jlog examples running from the Concepts Page and am getting JLOG_ERR_META_OPEN errors with both the reader and the writer. Here's the output from the running examples with jlog DEBUG turned on:

[vagrant@localhost jlog]$ rm -rf /var/log/jlogexample/*
[vagrant@localhost jlog]$ make
cc -I/home/vagrant/jlog -L/home/vagrant/jlog -ljlog writer.c -o writer
cc -I/home/vagrant/jlog -L/home/vagrant/jlog -ljlog reader.c -o reader
[vagrant@localhost jlog]$ ./writer
checkpoint one filename is /var/log/jlogexample/cp.6f6e65
checkpoint one filename is /var/log/jlogexample/cp.6f6e65
checkpoint two filename is /var/log/jlogexample/cp.74776f
checkpoint two filename is /var/log/jlogexample/cp.74776f
__jlog_open_metastore
__jlog_restore_metastore
jlog_ctx_open_writer_failed: 20 JLOG_ERR_META_OPEN
[vagrant@localhost jlog]$ ./reader
__jlog_open_metastore
checkpoint one filename is /var/log/jlogexample/cp.6f6e65
__jlog_restore_metastore
jlog_ctx_open_reader failed: 20 JLOG_ERR_META_OPEN

Any advice or other things I can try?

Thanks so much!

Blake

Here's the source of writer.c:

#include <stdio.h>
#include <string.h>

#include <jlog.h>

int main() {
    jlog_ctx *ctx;
    const char *path = "/var/log/jlogexample";
    int rc;

    ctx = jlog_new(path);
    if (jlog_ctx_init(ctx) != 0) {
    if (jlog_ctx_err(ctx) != JLOG_ERR_CREATE_EXISTS) {
        fprintf(stderr, "jlog_ctx_init failed: %d %s\n", jlog_ctx_err(ctx), jlog_ctx_err_string(ctx));
        exit(1);
    }

    jlog_ctx_add_subscriber(ctx, "one", JLOG_BEGIN);
    jlog_ctx_add_subscriber(ctx, "two", JLOG_BEGIN);
    }

    jlog_ctx_close(ctx);
    ctx = jlog_new(path);

    if (jlog_ctx_open_writer(ctx) != 0) {
    fprintf(stderr, "jlog_ctx_open_writer_failed: %d %s\n", jlog_ctx_err(ctx), jlog_ctx_err_string(ctx));
    exit(0);
    }

    rc = jlog_ctx_write(ctx, "hello\n", strlen("hello\n"));
    if (rc != 0) {
    fprintf(stderr, "jlog_ctx_write_message failed: %d %s\n", jlog_ctx_err(ctx), jlog_ctx_err_string(ctx));
    }

    jlog_ctx_close(ctx);
}

And reader.c:

#include <stdio.h>

#include <jlog.h>

int main() {
    jlog_ctx *ctx;
    const char *path = "/var/log/jlogexample";
    int rc;
    jlog_id begin, end;
    int count;

    ctx = jlog_new(path);
    if (jlog_ctx_open_reader(ctx, "one") != 0) {
    fprintf(stderr, "jlog_ctx_open_reader failed: %d %s\n", jlog_ctx_err(ctx), jlog_ctx_err_string(ctx));
    exit(1);
    }

    count = jlog_ctx_read_interval(ctx, &begin, &end);
    if (count > 0) {
    int i;
    jlog_message m;

    for (i = 0; i < count; i++, JLOG_ID_ADVANCE(&begin)) {
        end = begin;

        if (jlog_ctx_read_message(ctx, &begin, &m) == 0){
        printf("Got: %.*s\n", m.mess_len, (char *)m.mess);
        } else {
        fprintf(stderr, "jlog_ctx_read_message failed: %d %s\n", jlog_ctx_err(ctx), jlog_ctx_err_string(ctx));
        }
    }

    jlog_ctx_read_checkpoint(ctx, &end);
    }

    jlog_ctx_close(ctx);
}

publish on pypi.python.org

Thanks for jlog! Can you guys please make this package available through pypi so it's easier to distribute?

Integration for Go

I developed a wrapper for Go. I use it to push jlog data to an http endpoint. The endpoint is part of our email delivery analytics solution. I am willing to contribute the wrapper to this project, or share it in a separate project. Let me know if you are open to receive a pull request for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.