Skip to content

Remove console output from AppiumDriverLocalService by default #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

Mygod
Copy link

@Mygod Mygod commented Oct 6, 2016

Change list

Remove console output from AppiumDriverLocalService by default.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

Reason: I need to use System.out to print some less verbose output. And user can easily turn it back on by calling addOutPutStream.

However the other way around is hard. Here's what I'm currently using.

        try {
            streamField = AppiumDriverLocalService.class.getDeclaredField("stream");
            streamField.setAccessible(true);
            streamsField = Class.forName("io.appium.java_client.service.local.ListOutputStream")
                    .getDeclaredField("streams");
            streamsField.setAccessible(true);
        } catch (ClassNotFoundException | NoSuchFieldException e) {
            e.printStackTrace();
        }
        try {
            ((ArrayList<OutputStream>) streamsField.get(streamField.get(service))).clear(); // remove System.out logging
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

Reason: I need to use System.out to print some less verbose output. And users can easily turn it back on by calling addOutPutStream anyway.
@alexander-poulikakos
Copy link
Contributor

I fully agree on this PR. We should not log to System.out by default.

@SrinivasanTarget
Copy link
Member

@TikhomirovSergey ping

@jeangb
Copy link

jeangb commented Feb 16, 2017

Hi, this looks very interesting.
Any news on this ?

@jsf-clabot
Copy link

jsf-clabot commented Feb 20, 2017

CLA assistant check
All committers have signed the CLA.

@Mygod
Copy link
Author

Mygod commented Feb 20, 2017

@jeangb Meanwhile you can still use the workaround mentioned in the PR to get rid of the console output.

@jeangb
Copy link

jeangb commented Feb 20, 2017

Thank you @Mygod, in what class this workaround take place ?

@Mygod
Copy link
Author

Mygod commented Feb 20, 2017

@jeangb Just whenever you create a AppiumDriverLocalService, do this on that object.

@jeangb
Copy link

jeangb commented Feb 20, 2017

@Mygod great, thx

@selenUser
Copy link

@Mygod which type is streamField ? (which import should I do ?)

@Mygod
Copy link
Author

Mygod commented Feb 20, 2017

@selenUser

streamField = AppiumDriverLocalService.class.getDeclaredField("stream");

It's a Field in reflection. :)

@drapostolos
Copy link
Contributor

Perhaps this can be merged to master and released? To avoid workarounds...

@jeangb
Copy link

jeangb commented Feb 20, 2017

Do you think it would be possible to redirect this stream to an other view that console, in Eclipse. For example this view could be called Server.

jeangb added a commit to element-hq/riot-automated-tests that referenced this pull request Feb 21, 2017
@VenkateshPS
Copy link

Thanks @Mygod the workaround saved me.

@mykola-mokhnach
Copy link
Contributor

#909

@Prasannajnaeyulu
Copy link

This is where one can find the workaround until the appium server with this changes is released
element-hq/riot-automated-tests@73677dd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants