Nice - I didn't realize that your email was generated by Jira.  I'll repost my 
comment there.

Ralph


On Feb 19, 2012, at 2:02 PM, Ralph Goers wrote:

> 
> On Feb 19, 2012, at 11:20 AM, Hari Shreedharan wrote:
> 
>> 
>> 
>>> On 2012-02-19 16:30:08, Ralph Goers wrote:
>>>> I have a suspicion that if you actually try to use this from an 
>>>> application via a configuration file you won't be able to. I don't see any 
>>>> setter methods for the host and port.
>> 
>> The reason I didn't put setters for host and port are that the AvroClient 
>> object can be created only if know the hostname and port. So the constructor 
>> needs these arguments. If the hostname and port change because the config 
>> changes, the application can simply create a new object of the 
>> Log4jAppender(resetting the port and hostname using setters will have the 
>> same effect - since internally we would be doing the same thing, by 
>> replacing the protocolClient). For example this would be how the setter 
>> would look:
>> 
>> public synchronized void setHostnameAndPort(String hostname, int port){
>>    this.hostname = hostname;
>>    this.port = port
>>    protocolClient = null;     //This basically to make sure a new AvroClient 
>> is created, considering the new setting.
>> }
> 
> 
> I think you are missing the point.  Have you tried creating a log4j.xml or 
> log4j.properties and declaring the FlumeAvroAppender in it to see if it will 
> work? The vast majority of Log4j users do not programmatically declare their 
> appenders. To require that makes the Appender almost useless.
> 
> FWIW, I've written a Flume appender (for OG) for Logback for my employer but 
> I haven't published it anywhere. I've also written a FlumeAvroAppender for 
> Log4j 2 for both OG and NG.  See 
> http://people.apache.org/~rgoers/log4j2/manual/appenders.html#FlumeAvroAppender.
>   Feel free to review the code - the NG source is at 
> https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/log4j2-flume-ng/. 
> Any suggestions you have would be most welcome.
> 
> Ralph

Reply via email to