提高Apache Samza中的日志记录级别

时间:2016-09-20 23:47:19

标签: logging clojure apache-samza

我正在尝试更改Apache Samza的日志记录级别,以便我可以获得 var URL_ALL_USERS = "/api/users"; import Button from 'react-bootstrap/lib/Button'; import Modal from 'react-bootstrap/lib/Modal'; import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; import FormGroup from 'react-bootstrap/lib/FormGroup'; import FormControl from 'react-bootstrap/lib/FormControl'; import Col from 'react-bootstrap/lib/Col'; import Form from 'react-bootstrap/lib/Form'; import ControlLabel from 'react-bootstrap/lib/ControlLabel'; var React = require('react'); var ReactDOM = require('react-dom'); var ISRBox = React.createClass({ getInitialState: function() { return {searchData: [], profileData: {}, modalStatus: false}; }, updateList (newData) { this.setState({searchData: newData}); }, openUserManager(userdata) { this.setState({modalStatus: true, profileData: userdata}); }, closeUserManager() { this.setState({modalStatus: false}); }, render: function() { return ( <div className="isrBox"> <h1>ISR Manager </h1> <button onClick={this.openUserManager}>Add User</button> <UserHandle userdata={this.state.profileData} status={this.state.modalStatus} closeManager={this.closeUserManager}/> <SearchForm clickHandler={this.updateList} url={URL_ALL_USERS}/> <UserList data={this.state.searchData} onUserEdit={this.openUserManager}/> </div> ); } }); var UserList = React.createClass({ render: function() { var userNodes = this.props.data.map(function(user) { return ( <tr className="rowStyle" onClick={() => this.props.onUserEdit(user)} key={user.id}> <td>{user.email}</td> <td>{user.name}</td> <td>{user.info}</td> <td>{user.lastlogin}</td> </tr> ); }, this); return ( <div className="userList"> <table className="tableStyle"> <thead> <tr> <th>Email</th> <th>User Name</th> <th>Study, Site ID, Role</th> <th>Last Login</th> </tr> </thead> <tbody> {userNodes} </tbody> </table> </div> ); } }); var SearchForm = React.createClass({ getInitialState: function() { return { study: '', site: '', name: '', email: '', }; }, handleChange: function(name, event) { var change = {}; change[name] = event.target.value; this.setState(change); }, search: function() { $.ajax({ url: this.props.url + "?study=" + this.state.study + "&site=" + this.state.site + "&name=" + this.state.name + "&email=" + this.state.email, dataType: 'json', cache: false, success: function(data) { this.props.clickHandler(data); }.bind(this), error: function(xhr, status, err) { console.error(this.props.url, status, err.toString()); }.bind(this) }); }, render: function() { return ( <div className="searchForm" > <div className="input"> <input type="text" placeholder="Study Code (full or partial) " value={this.state.study} onChange={this.handleChange.bind(this, 'study')} /> </div> <div className="input"> <input type="text" placeholder="Site ID (full or partial) " value={this.state.site} onChange={this.handleChange.bind(this, 'site')} /> </div> <div className="input"> <input type="text" placeholder="Name (full or partial) " value={this.state.name} onChange={this.handleChange.bind(this, 'name')} /> </div> <div className="input"> <input type="text" placeholder="Email (full or partial) " value={this.state.email} onChange={this.handleChange.bind(this, 'email')} /> </div> <div className="input"> <button onClick={this.search}>Do Search</button> </div> </div> ); } }); var UserHandle = React.createClass({ getInitialState() { return {data: this.props.userdata}; }, refresh() { this.setState({ data: this.props.userdata}); }, handleChange: function(name, event) { var change = this.state.data; change[name] = event.target.value; this.setState({ showModal: true , data: change}); }, render() { return ( <div> <Modal show={this.props.status} onHide={this.props.closeManager} onEntering={this.refresh}> <Modal.Header closeButton> <Modal.Title>User Management</Modal.Title> </Modal.Header> <Modal.Body> <Form horizontal> <FormGroup controlId="formEmail"> <Col componentClass={ControlLabel} sm={2}> Email </Col> <Col sm={10}> <FormControl type="email" placeholder="Email" value={this.state.data.email} onChange={this.handleChange.bind(this, 'email')}/> </Col> </FormGroup> <FormGroup controlId="formUser"> <Col componentClass={ControlLabel} sm={2}> User </Col> <Col sm={10}> <FormControl type="text" placeholder="User name" value={this.state.data.name} onChange={this.handleChange.bind(this, 'name')}/> </Col> </FormGroup> <FormGroup controlId="formComment"> <Col componentClass={ControlLabel} sm={2}> Comment </Col> <Col sm={10}> <FormControl type="text" placeholder="User name" value={this.state.data.comment} onChange={this.handleChange.bind(this, 'comment')}/> </Col> </FormGroup> </Form> </Modal.Body> <Modal.Footer> <Button onClick={() => this.props.closeManager}>Close</Button> </Modal.Footer> </Modal> </div> ); } }); ReactDOM.render( <ISRBox />, document.getElementById('content') ); 个语句;默认值为debug。更具体地说,我正试图让this debug statement出现。

我在Clojure项目中使用Samza。做这个的最好方式是什么? Samza Logging页面未提供任何有用信息。

1 个答案:

答案 0 :(得分:2)

Samza Logging页面提供了足够的信息。更直接地说,步骤是:

    project.clj中的
  1. ,包括slf4j-log4j依赖
  2. 在project.clj中,定义一个名为“log4j.configuration”的jvm系统属性,该属性指向log4j xml配置文件
  3. 在log4j xml配置文件中,将根日志级别定义为“debug”
  4. 其中哪些事情已经完成?